当前位置:网站首页>Go language advantages and learning Roadmap

Go language advantages and learning Roadmap

2022-06-11 02:58:00 Procedure 15528175269

brief introduction

Go Language is also called Golang, from Google The company 2009 Released in , In recent years, with Cloud Computing 、 Microservices 、 With the development of distributed technology, it has risen rapidly , Become one of the mainstream programming languages , and Java similar , It is a static 、 Strongly typed 、 Compiled programming languages , Born for concurrency , So it is naturally suitable for concurrent programming ( Network programming ).

at present Go Language support Windows、Linux Wait for multiple platforms , You can also directly Android and iOS Wait for the mobile terminal to execute , From a business perspective ,Go Language in cloud computing 、 Microservices 、 big data 、 Blockchain 、 The Internet of things 、 Artificial intelligence and other fields are widely used . So learning now is the right time .

Comparison with other languages

C/C++

Go The original intention of the design is to replace C, So there are many similarities between the two , but Go Do more :

  • Provides a runtime that automatically manages threads and garbage collection , stay C/C++ in , You need to manage your own threads and memory
  • Faster compilation speed

therefore , relative C/C++,Go More efficient development .

Different scenarios :

  • C/C++ It can be used in high-performance embedded systems 、 Large cloud applications and desktop application development
  • Go It is applicable to system and cloud platform development

Go Not applicable to high-performance embedded systems , Because the resources of embedded system are limited , and Go Scheduling threads and garbage collection at runtime requires additional overhead . So far no GUI SDK, So it is not suitable for desktop application development .

Java

Java After compiling the program, you need to install additional Java runtime function ,Java The portability of programs depends on Java runtime,Go Unwanted ,Go The runtime is already included in the compiled binary , The difference reflected in the deployment is that it needs to be installed on the server Java runtime, and Go Just deploy a single file .

The other is when the program is executed ,Go It is compiled into binary files and executed by the operating system , and Java It usually includes JIT Compiler JVM In the implementation of ,JIT Code will be optimized .

Python/PHP

Python/PHP All dynamic languages , and Go It's a static language , I can do type checking , Higher reliability .

Development Web When applied ,Python/PHP Usually hiding in Nginx/Apache Later, it acts as a background process ,Go Provides built-in Web The server , It can be used directly in the production environment .

Python/PHP With the help of additional Web The server handles concurrent requests ,Python There is a global lock that allows only one thread to run at the same time ,PHP There is no multi thread and multi process mechanism , A request is an independent process from the beginning , In order to make based on Python/PHP Of Web Applications support concurrent requests , It is necessary to resort to external Web The server .

and Go Built in Web The server makes full use of goroutine, Good support for concurrent connections . Besides , Because the essence of a coroutine is to schedule different threads in the same process , So it also supports sharing resources .

The other is Python/PHP As a dynamic language , Performance is not as good as Go, If you want to improve Python/PHP performance , Must pass C Language writing extensions , Complexity and learning costs are too high .

JavaScript

there JavaScript, Mainly Node.js.

JavaScript It is a single-threaded model , Although asynchronous IO Mechanisms can use different threads , The main program still runs in single thread mode , The time-consuming main program code will block the execution of other code .

and Go The multithreading model of the language can run in different threads of multiple processors through the runtime management scheduling process , Make full use of system hardware .

Node.js Use Google Chrome Of V8 engine , It contains a with JIT Compiler's virtual machine , It can be done to JavaScript Code optimization to improve performance , and Go The code is directly compiled into machine code for execution , There is no such thing , There is no need .

notes : The above comparison contents are compiled from 《Go In Practice》 This book .

Learning Roadmap

notes : There are many books listed here , Just pick the ones you are interested in , I really want to read all these books , Not for threeorfive years .

And the map of basic knowledge :

 

And a complete one roadmap:

Of course , In the learning process , Official documents   It is also an indispensable hand tool .

Next, you will start from the basic knowledge , Help you get started Go Language development , Then the actual demonstration is carried out in combination with the microservice architecture and development , So that we can fully master the language .

原网站

版权声明
本文为[Procedure 15528175269]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206110230066938.html