当前位置:网站首页>Interviewer: is it acceptable to transfer to go?
Interviewer: is it acceptable to transfer to go?
2022-07-19 13:18:00 【Yinbailer】
1、 introduction
Hello everyone , I'm yinbelle , Recently, there are many little friends who are experiencing internships 、 Interview of Qiu Zhao , I believe that many partners will meet the company they are interviewing 、 The programming language used by the Department is different from what I am familiar with , Many friends sent me private messages saying that now many interviewers will ask whether they can accept transfer Go Language , Ask my advice , Hey, isn't this a coincidence , Here comes the video material , Friends who know me well know that I graduated this year , Bytes removed by calibration , I haven't been in contact with business during the period of graduation and the past few weeks of entry , Are familiar with Go Language and related frameworks .
Then I want to share my card in this video Go Feelings . Because the projects done in school, including summer internship in Alibaba, are used Java, So subjectively, it will be more with Java Look at Go, At the same time, I will try to make it easy to understand , Let the little friends who just came into contact with programming have a general understanding .
2、Go First experience
2.1 Go The origin of
Let me give you a brief introduction Go The origin of language ,Go Language (Golang) origin 2007 year , It's an internal project of Google , And in 2009 Officially released in ,java I remember it was 1995 Published in . Design Go Its original intention is to make its compilation speed comparable to C or C++, The syntax is simpler and safer , Native supports concurrency .
① This one in the middle is Rob Pike,Go Head of language project , Bell LABS Unix Team members , Participating projects include Plan 9,Inferno Operating system and Limbo programing language ;
② On the left is RobertGriesemer, Participation in development JavaHotSpot virtual machine 
③ This one on the right is Ken Thompson, Bell LABS Unix Team members ,C Language 、Unix and Plan 9 One of the founders of , And Rob Pike Jointly developed UTF-8 Character set specification
2.2 Go Learning experience
Let's start with the results , Overall, I feel pretty good , After all Go It's developing very fast , Especially the new version 1.18 Generics are also added . When I write here, I suddenly find myself really lucky , Learn at school Java It's time to have springboot Family bucket , You don't have to suffer when doing projects JSP The devastation of ;Go After many iterations, updates and some gin、gorm Easy to use framework blessing , Package management tools are also built in mod, Don't write disgusting code and configuration . I think the maturity of the framework is very friendly for new people who come into contact with a language , You can directly write some small projects to practice your hand , Next, let's talk about our feelings from a few points , First, share some intuitive feelings .
1、 Normative
Specifications are greater than conventions , That is to say, if I don't make an appointment with you , You have to follow this set of rules , If you don't compile according to the specification, you can't pass .
- Such as exported packages and defined variables , If it is not used, an error will be reported , Can't accommodate redundant statements .
- And naming conventions , Can the defined variable be externally referenced ,Java Through the keyword public perhaps private To decide ,Go Is distinguished by the case of variables
- Go Function overloading is not allowed on , Must have unique names for methods and functions .Java Allow function overloading .
2、 Speed , Factorials are used to test performance on the Internet , You can see after running on this machine , In the case of a single thread 
in addition ,Go There is also a more powerful feature in the native support for high concurrency , In the concurrent scenario Go It adopts a collaborative process with smaller resource granularity , I also ran a few hours demo To test performance , Find out Go Performance ratio of Java There is no very significant enhancement , I'm looking for the answer on the Internet , Finally found this sentence :
Go The level of performance is related to the programming ability of programmers
package main
import (
"fmt"
"math/big"
"strconv"
"time"
)
func main(){
allInputs := [5]int64{
10000, 50000, 100000, 500000, 1000000}
var i int = 1
for i=0;i<len(allInputs);i++ {
var before = GetTimeStamp()
var factorial *big.Int = big.NewInt(1)
var j int64 = 1
for j=1; j<=allInputs[i]; j++ {
factorial = factorial.Mul(factorial,big.NewInt(j))
}
var after = GetTimeStamp()
var elapsedTime = after - before
gap,_ := strconv.ParseFloat(fmt.Sprintf("%.2f", float64(elapsedTime)/float64(1000)), 64)
fmt.Printf("%v The factorial time is %v second \n",allInputs[i],gap)
}
}
func GetTimeStamp() int64 {
// Get the millisecond timestamp
return time.Now().UnixNano() / int64(time.Millisecond)
}
import java.math.BigDecimal;
import java.math.BigInteger;
class TestDemo {
public static void main(String []args) {
int[] allInputs = new int[]{
10000, 50000, 100000, 500000, 1000000};
for (int i = 0; i < allInputs.length; i++) {
BigInteger number = BigInteger.valueOf(allInputs[i]);
BigInteger result = BigInteger.valueOf(1);
long before = System.currentTimeMillis();
for (int j = 1; j <= allInputs[i]; j++) {
result = result.multiply(BigInteger.valueOf(j));
}
long after = System.currentTimeMillis();
System.out.println(allInputs[i] + " The time taken for factorial " +
new BigDecimal((float)(after - before)/1000).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()+" second ");
}
}}
3、 object-oriented
I try to share clearly , Here and Java The difference is big , Three basic characteristics of object-oriented : encapsulation 、 Inherit 、 polymorphic .
One thing that needs to be clear is ,Go Not an object-oriented language , But it does not prevent it from having object-oriented features .
- The first is encapsulation ,Go There is no concept of a class , Use structure to package , And there are only attributes in the structure , Methods and structures are separate , You can see that the method is bound to the structure ,Go There are few references in , It's usually The pointer . Maybe the author wants to give users of structures more flexibility . That is, even if you are not the author of the structure , You are also free to add new “ Member method ”.

- Inherit , stay Java We have used the customary inheritance method in Go None of them ,Go Inheritance is realized through combination , Let a structure A Contains a structure B, So as to achieve A To inherit B Characteristics of .

- Polymorphism usually means , Subclass objects can be used wherever parent objects are used , Simply speaking , Polymorphism means that variables of the parent type can refer to objects of the child type . for instance , There are many kinds of fruits , a mandarin orange 、 Banana , Now I want a fruit ( Don't specify which fruit you want ), Give me an orange or banana ok Of , This is that variables of the parent type can refer to objects of the child type .Java Allow polymorphism by default , and Go But there was no ,Go Polymorphism in is through
InterfaceRealized .
package main
import "fmt"
type Code interface {
introduce()
}
type Java struct {
name string
}
func (javaTest Java) introduce() {
fmt.Println("this is java")
}
type Go struct {
name string
}
func (goTest Go) introduce() {
fmt.Println("this is go")
}
func introduce(code Code) {
code.introduce()
}
func main() {
introduce(&Java{
})
introduce(&Go{
})
}
We can see that when we add a function to the system , Not by modifying the code , But by adding code , So that is Opening and closing principle The core idea of .Go Pass through interface To provide an abstract interface , So as to achieve high cohesion , Low coupling .
3、 Video plan :
I found that many friends are right Go Language is more interesting , But under the pressure of work or study, it is not necessary for the time being Go Language , Want to know, but was persuaded by dozens of hours of tutorial videos , and Go Language is currently in the stage of rapid development , Get faster , The syntax in many videos is no longer applicable .
So I'm going to put Go Divided into primary 、 senior 、 Three parts of actual combat , With Java Turn around and make a series of sharing videos in your learning process , Each update will put the video on the corresponding blog , The content should be concise and easy to understand , You can get started by video , The links to supplementary documents in the difficult part ensure that everyone can have an in-depth understanding on the premise of energy , The video will not change, but the document can be updated , If there is any change, I will update my blog in time .
There is a gift I prepared for you on my blog ( Learning materials and learning tools ), Just take it yourself , I will also send updates and updates to official account as soon as possible , The official account also has an internal link for you to prepare big factories , Interested partners can easily pay attention .
In addition, my team in the company , There is a step-by-step plan every week , That is to say, we often use but dig deep technology stacks , For example, last issue talked about mysql, The index 、buffer、 Clusters and other parts are talked about deeply . After that, I will also pick some wonderful parts to blog + Share the video with you , I hope you guys can pay attention , It is convenient to push it to you in a timely manner .
What theme videos do you want to see? You can leave a message and interact at the bottom of the video , I will put the blog link of each video in the introduction , It is convenient for everyone to check .
4、 Question answering :
How should we treat it Go Language , I have a little opinion , That's it “ Refuse to eat the old technology , Always learn new technology and keep yourself ”, No matter what technology stack you are currently using , It's always right to have the opportunity to learn more . hold Go As my second programming language, I think it's a very good decision .
But if you are a school recruit who is looking for a job , I suggest to Java perhaps C++ Mainly , Why? , Because now the situation is Go Jobs are generally in big factories , Large factories have many application scenarios and have the capital to try and make mistakes , Small factories still aim at stable operation , Besides, even if you interview Go Your position is also available Java perhaps C++ Knowledge points ,Go Language can be regarded as a bonus for you . Big factories usually don't pick technology stacks when recruiting fresh students , Just go deep into one , And have good basic knowledge and thinking , Just come in and cultivate again .
Okay , That's all about this video , If you like this video , Remember to pay attention to one button three times 
边栏推荐
- 力扣198-213 打家劫舍Ⅰ、Ⅱ——动态规划
- 最懂你的服装设计师是AI?让用户 “凭心意” 生成数字服装#Adidas OZWORLD
- Is the career direction of test / development programmers over 35 a turning point in the workplace?
- MOF customized materials | bimetallic CuNi MOF nano materials | core-shell structure [email protected] Nanocomposites | zif-8/ poly
- Mycat2 builds MySQL master-slave separation
- 深度梳理:机器学习建模调参方法总结
- LeetCode 0117. 填充每个节点的下一个右侧节点指针 II
- Is it safe for Everbright futures to open an account online? Are there any account opening guidelines?
- 音频常见端子剖析图---再也不会搞错了
- Flask source code analysis (III): Context
猜你喜欢

Reg of sequential logic and combinatorial logic

面试官:可以接受转Go吗?

每周小结(*65):有计划的输出

Azkaban installation documentation

LeetCode 0117. 填充每个节点的下一个右侧节点指针 II

如何优雅的升级 Flink Job?

VMware导入ova/ovf虚拟机文件

CMOS开关学习(一)

Stable super odds, 9 years old mixin | 2022 Jincang innovative product launch was successfully held

LeetCode 0565. Array nesting: convert to graph + modify in place の optimization
随机推荐
[Tencent blue whale] the seventh 7.24 operation and maintenance day holiday greetings ~ come and make a wish~
2022 global developer salary exposure: China ranks 19th, with an average annual salary of $23790
C语言进阶——字符函数和字符串函数
Li Kou 413 division of equal difference sequence dynamic programming
面试难题:分布式 Session 实现难点,这篇就够!
JVM self study summary
Use golang to correctly process the IP data of the five major Internet registration agencies
Is the career direction of test / development programmers over 35 a turning point in the workplace?
LeetCode 0565.数组嵌套:转换为图 + 原地修改の优化
Visual ETL tool kettle concept, installation and practical cases
响应式织梦模板酒窖类网站
Li Kou 198-213 looting Ⅰ, Ⅱ - Dynamic Planning
O & M LITTLE WHITE Growth record - architecture week 6
力扣198-213 打家劫舍Ⅰ、Ⅱ——动态规划
AE如何制作星云粒子特效
[pyGame learning notes] 7 event
Go unit test
Attachment handling of SAP Fiori
In depth sorting: summary of machine learning modeling and parameter adjustment methods
Li Kou 70 - climbing stairs - Dynamic Planning