This is a creation in
Article, where the information may have evolved or changed.
In recent days idle bored, the boss to recommend a new language Golang (for me), looked at some
Introduction, also wrote a few small demo, immediately fell in love with the language, with a "life not only, tossing endlessly"
very Guest Spirit, also writes a small blog, publishes some personal opinion.
I master language Java, if said comparison, then take Java and Golang to do a comparison, the purpose of comparison is not to
cited "PHP is the best language in the world" is a meaningless language dispute, but a language application scenario
have a a general understanding, in order to meet the different business scenarios of application, in fact, for me is a kind of learning, a kind of thinking
die type of practice.
First of all, the experience of writing Golang program, write it is really cool, no contact with Golang before, write a program in Java
, the IDE is OK, the code does not feel too verbose, but with the Golang is different, Golang
like a Swiss Army knife, small, lean, sharp, instantly feel Java in this area weak explosion.
last HelloWorld Generation Code compare it to the following:
Java Edition:
Version Golang:
See no, Golang even the semicolon is saved, concise, not much to say, later there are more examples.
Galang as a modern language, absorbing, behind is Google this big patron, absorbing a variety of languages
The essence of the design concept is to solve many problems in software engineering, is a bias in the service-side
programming language, the main purpose of which is to support the writing of large distributed systems, is now becoming more mature, like Docker, today's headline micro-service architecture, seven kn of cloud storage. Here are some of the advantages of Golang or the place that attracts me:
1. It provides concurrency support at the language level, unlike Java, a library-level, and concurrent tool
, writing high-quality concurrent programs in Java is a very challenging task. and Golang different, first of its concurrency model design is better, with a call to the process (which is a more lightweight thread) of the concept of processing concurrency, can open tens of thousands of simultaneous processes without pressure, while solving the thread switching overhead, can maximize the performance of the CPU, In particular, the current server on the dozens of-core processor, the advantages of multi-core to the extreme, which is its biggest advantage than other languages.
2. Its standard library tools are powerful: This includes Internet applications, system programming, and network programming. Go inside the standard
The library is basically already very stable, especially the three I mentioned here, the network layer, the system layer of the library is very practical
3. There is a pointer (but no c pointer operation), there is garbage collection (now more perfect, give force), Go
language words support when all of the previous programming paradigms, including procedural programming, object-oriented programming, and functional programming. Programmers can picking, free to mix, want to play how to play, The programming is very flexible and gives programmers have a lot of imagination space, while the self-brought tools in the source code before the fixed format, so that the format is unified, all programmers write code are the same format, easy to develop and read the source.
This is the above I feel more deep, of course
, there are many advantages of Golang, there are also imperfect places to
I intend to learn the go language as a second language, and also to share more articles about go, and I hope to read this article you and I join the Go language family, the following is attached to the June 2017 programming language leaderboard, from which you can find Golang current development momentum is how hot:
go up from 48 to now 15 in a year, looking at its growth rate of 1.83%, compared to other languages, ranked the top three
language is negative, and in Golang front of the language does not have a growth rate of more than 1%, so I am very optimistic about the development of Golang, strong development team, perfect documents, hot community and distributed development needs, these are the driving force of this language thriving.