This is a creation in
Article, where the information may have evolved or changed.
| Guide |
A few weeks ago, a friend of mine asked me, "Why should I care about the Go language"? Because they know I am passionate about the Go language, but they want to know why I think other people should also care. There are three reasons: security, productivity, and concurrency. Some languages can cover one or two aspects, but the combination of these three makes Go a great choice for mainstream programmers. |
A few weeks ago, a friend of mine asked me, "Why should I care about the Go language"? Because they know I am passionate about the Go language, but they want to know why I think other people should also care. This article contains three reasons why I think Go is an important programming language.
Safety
Personally, you and I may be perfectly capable of writing programs in C without leaking memory or unsafe reuse of memory. On the whole, however, even with more than 40 years of experience, programmers with C cannot reliably do so.
Although static code analysis, Valgrind, Tsan, and "-werror" have existed for decades, there is little evidence that these tools are widely accepted, let alone widely adopted. All in all, it turns out that programmers simply can't manage their own memory safely. Now it's time to leave C.
Go does not require the programmer to manage memory directly, all memory allocations are managed by the language runtime, initialized before use, and checked for boundaries, if necessary. It is certainly not the first mainstream language to provide these security guarantees, and Java (1995) may be a contender for the championship. The point is that the world has no appetite for unsafe programming languages, so it is assumed by default that Go is memory safe.
Developer Productivity
From the late 1970s, the developer's time became more expensive than the time spent on hardware. Developer productivity is an expanding topic, but it boils down to this: how much time do you spend doing useful work, and how much time you have to wait for the compiler or be disappointed to get lost in the external code base.
There is a joke that Go is being developed while waiting for C + + programs to compile. Fast compilation is an important feature of Go and a key tool for attracting new developers. Although the compilation speed is still a permanent battlefield, it is fair to say that it takes a few minutes to compile in other languages and only takes a few seconds to Go.
The Go programmer realizes that the more fundamental problem with productivity is that the code is written for reading , so the reading behavior of the code is put on the writing. Go uses tools and customizations to force all code formatting into a specific style. This eliminates the difficulty of learning the dialect of a project-specific language and helps to find errors because they appear to be incorrect.
With a focus on analytics and machine assistance, go developers are starting to use more and more tools to discover common coding errors that have never resonated with C language developers-The GO developers want tools to help them keep their code clean.
Concurrency of
For more than 10 years, chip designers have been warning that free lunch will be over. From the lowest-end phones to the most power-hungry servers, hardware parallelism occurs in more, slower, CPU-bound cores, but only if your language can make sense of them. Therefore, the concurrency feature needs to be built into the software we write to run on today's hardware.
By providing a lightweight concurrency model based on the process, or the goroutines,go known in Go goes beyond the languages that expose the multi-process or multithreaded parallel model of the operating system. Goroutines allows programmers to avoid complex callbacks, while the language runtime ensures that there are enough threads to keep your kernel active.
Summarize
I recommend Go for a friend for three reasons: security, productivity, and concurrency. Some languages can cover one or two aspects, but the combination of these three makes Go a great choice for mainstream programmers.
Free to provide the latest Linux technology tutorials Books, for open-source technology enthusiasts to do more and better: http://www.linuxprobe.com/