当前位置:网站首页>Go language introduction detailed tutorial (I): go language in the era
Go language introduction detailed tutorial (I): go language in the era
2022-07-05 23:29:00 【Look, the future】

List of articles
The previous article is relatively general , But I did go through the knowledge points quickly , Mixed with a familiar face . But I still suggest that whether there is a basic partner or not , I've been through this series of tutorials for getting started , Because it is difficult for us to grasp some internal things of language when we get started quickly .
Go Language core development team
Go glottogony 2007 year , And in 2009 Officially released in . It is from 2009 year 9 month 21 As a Google company on the th 20% Part-time project , That is, relevant employees use 20% Spare time to participate in Go Language research and development . The three leaders of the project are all famous IT The engineer :Robert Griesemer, Participation in development Java HotSpot virtual machine ;Rob Pike,Go Head of language project , Bell LABS Unix Team members , Participating projects include Plan 9,Inferno Operating system and Limbo programing language ;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 . since 2008 year 1 Month begins ,Ken Thompson We began to develop a product with C Language as the target result of the compiler to expand Go The design idea of language .
This is a field by computer “ The father of invention ” The golden team , Their understanding of system programming languages , Operating system and parallelism have very deep insights
Why should I put such a paragraph at the beginning of the series ?
I don't know how many people have thought about it like me : If there is a language , It has C++ Stability and speed , Yes python The concise , also Java The garbage collection mechanism of . How awesome that must be !!!
Now? , With .
Under the times go Language
1、 just as “21 Century's C Language ” What this sentence says ,Go Language is not made out of thin air , But and C++、Java and C# It belongs to C system . More Than This , The designers also absorbed the essence of other programming languages into Go In language .
2、 In terms of declaration and package design ,Go Language affected Pascal、Modula and Oberon The influence of language ; In the design of concurrency principle ,Go Language is also affected by Tony Hoare Of CSP( Communication sequence process Communicating Squential Processes) Theoretically influenced Limbo and Newsqueak Some experience has been learned from the practice of , And used and Erlang Similar mechanism .
3、 This is a completely open source programming language , Because it uses BSD licensing , So anyone can develop commercial software without paying any fees .
4、 Although in order to enable the current mainstream developers to Go Class in language C The grammar of the language feels very friendly and easy to transform , But it greatly simplifies these grammars , Make them better than C/C++ The grammar of is more concise and clean . meanwhile ,Go Language also has some characteristics of dynamic language , This enables the use of Python and Ruby Developers are using Go It feels very easy to use language .
Why create go Language ?
1、C/C++ The development speed of can't keep up with the pace of computer development , For more than ten years, there has not been a mainstream system programming language in line with the times , Therefore, people need a new system programming language to fill this gap , Especially in the computer information age .
2、 Compared with the improvement of computer performance , The field of software development is not considered to be growing fast enough or more successful than hardware ( Many projects have failed ), At the same time, the volume of the application is always expanding , This urgently requires a low-level language with higher-level concepts to break through the current situation .
3、 stay Go Before language , Developers are always faced with very difficult choices , It's a language that runs fast but doesn't compile well ( Such as :C++), Or use a language that compiles faster but performs poorly ( Such as :.NET、Java), Or a dynamic language with low development difficulty but low execution speed ? obviously ,Go The language is here 3 The best balance is achieved between the conditions : Quick compilation , Efficient execution , Easy to develop .
go Language development goals
1、Go The main goal of language is to combine the security and efficiency of static language with the ease of development of dynamic language , Reach the perfect balance , It makes programming more fun , Instead of making painful choices .
therefore ,Go Language is a type safe and memory safe programming language . although Go There are still pointers in the language , But pointer operations are not allowed .
2、Go Another goal of language is for network communication 、 Excellent support for concurrent and parallel programming , So as to make better use of a large number of distributed and multi-core computers , This is very important for Google's internal use . The designer passed goroutine This concept of lightweight threads to achieve this goal , And then through channel To achieve each goroutine Communication between . They achieved segmented stack growth and goroutine Automation of multiplexing technology based on threads .
This feature is obviously Go The most powerful part of language , It not only supports the increasingly important multicore and multiprocessor computers , It also makes up for the shortcomings of existing programming languages in this regard .
3、Go Another very important feature of the language is its construction speed ( The speed of compiling and linking to machine code ), In general, it takes only hundreds of milliseconds to a few seconds to build a program . As a mass use C++ To build infrastructure for Google , There is no doubt that it has fundamentally got rid of C++ A nightmare that is not ideal in terms of construction speed . This not only greatly improves the productivity of developers , At the same time, it also makes the code testing link in the software development process more compact , Instead of wasting a lot of time waiting for the program to be built .
4、 Dependency management is an important part of software development nowadays , however C In language “ The header file ” As a result, more and more large-scale projects need several hours to build due to dependencies . People increasingly need a strict 、 Concise dependency analysis system, which can quickly compile the programming language . That's exactly what it is. Go The fundamental reason why the language adopts the package model , This model accelerates program construction through strict dependency checking mechanism , It provides very good scalability .
Whole Go The compilation time of language standard library is generally 20 Within seconds , Other regular projects only need half a second to complete the compilation . This lightning fast compilation is even faster than compilation C Language or Fortran Faster , This makes compilation no longer a problem that puzzles developers in software development . before this , Dynamic language takes fast compilation as its highlight , image C++ Such static languages generally have a very long compilation and linking work . And also as a static language Go Language , Through its own excellent construction mechanism , Successfully removed this drawback , Make the construction process of the program trivial , Have the ability of efficient development like script language and dynamic language .
5、 in addition ,Go Language can also be compared with C/C++ par .
6、 Due to memory problems ( It is often called a memory leak ) It has been accompanied by C++ Developers of ,Go Language designers believe that memory management should not be a consideration for developers . So even though Go Language executes local code like other static languages , But it still runs a virtual machine in a sense , In order to achieve efficient and fast garbage collection ( A simple tag is used - Clear algorithm ).
Although garbage collection is not easy to achieve , But consider that this will be an important part of the development of concurrent applications in the future ,Go The designers of the language still completed this difficult task .
7、Go The language can also perform reflection related operations at runtime .
8、 Use go install It is easy to deploy third-party packages .
Besides ,Go The language also supports calling by C Massive library files written in , Thus, the software developed in the past can be quickly migrated .
go Characteristics of language
Go Language is essentially ( Procedural and structural aspects ) To achieve concurrent programming . because Go Language has no concept of class and inheritance , So it's connected to Java or C++ It doesn't look the same . But it's through the interface (interface) To achieve polymorphism .Go Language has a clear and easy to understand lightweight type system , There is no hierarchy between types . So it can be said that this is a mixed language .
In traditional object-oriented languages , Using object-oriented programming technology is very bloated , They always build huge type hierarchies through complex patterns , This goes against the purpose that programming languages should improve productivity .
Go The language uses static types , So it's a type safe language , Plus by building into native code , The execution speed of the program is also very fast .
As a strongly typed language , Implicit type conversions are not allowed , Remember a principle : Make everything explicit .
Go The language supports cross compilation , For example, you can run Linux The system is developed and run on the computer Windows Applications running under . This is the first door to fully support UTF-8 Programming language , It's not just that it can handle the use of UTF-8 Encoded string , Even its source file format is used UTF-8 code .Go Language is truly international !
About missing features
Many features that can be used in most object-oriented languages Go Languages are not supported , But some of them may be supported in the future .
To simplify the design , Function overloading and operator overloading are not supported
In order to avoid C/C++ Some in development Bug And chaos , Implicit conversion is not supported
Go Language implements object-oriented design in another way to give up the inheritance of classes and types
Dynamic loading of code is not supported
Dynamic link libraries are not supported
Generics are not supported
adopt recover and panic To replace the exception mechanism
Static variables are not supported
边栏推荐
- Scala concurrent programming (II) akka
- 424. 替换后的最长重复字符 ●●
- 698. 划分为k个相等的子集 ●●
- 98. 验证二叉搜索树 ●●
- 秒杀系统的设计与实现思路
- 2022 registration examination for safety management personnel of hazardous chemical business units and simulated reexamination examination for safety management personnel of hazardous chemical busines
- Neural structured learning - Part 3: training with synthesized graphs
- Douban scoring applet Part-2
- Krypton Factor purple book chapter 7 violent solution
- White hat talks about web security after reading 2
猜你喜欢

Pyqt control part (I)

98. 验证二叉搜索树 ●●

2:第一章:认识JVM规范1:JVM简介;

Go语言实现原理——锁实现原理

Brushless drive design -- on MOS drive circuit

There are 14 God note taking methods. Just choose one move to improve your learning and work efficiency by 100 times!

进击的技术er——自动化

《牛客刷verilog》Part III Verilog企业真题

Dynamic planning: robbing families and houses

LeetCode145. Post order traversal of binary tree (three methods of recursion and iteration)
随机推荐
Leetcode sword finger offer brush questions - day 21
Commonly used probability distributions: Bernoulli distribution, binomial distribution, polynomial distribution, Gaussian distribution, exponential distribution, Laplace distribution and Dirac delta d
The maximum happiness of the party
代码农民提高生产力
Go language implementation principle -- map implementation principle
数据库基础知识(面试)
February 13, 2022 -5- maximum depth of binary tree
LabVIEW打开PNG 图像正常而 Photoshop打开得到全黑的图像
3D point cloud slam
LeetCode——Add Binary
Common static methods of math class
[classical control theory] summary of automatic control experiment
Neural structured learning - Part 3: training with synthesized graphs
regular expression
poj 2762 Going from u to v or from v to u? (infer whether it is a weak link diagram)
poj 2762 Going from u to v or from v to u? (推断它是否是一个薄弱环节图)
Non rigid / flexible point cloud ICP registration
Using LNMP to build WordPress sites
Creative mode 1 - single case mode
Getting started stm32--gpio (running lantern) (nanny level)