Why Go?

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

A few weeks ago I was asked by a friend, what should I care about Go? They knew that I was passionate on Go, but wanted to know what I thought other people should care. This article contains three salient reasons what I think Go is an important programming language.

Safety

As individuals, you and I are perfectly capable of writing a program in C that neither leaks memory or reuses it unsafe Ly. However, with more than years of experience, it's clear that collectively, programmers working in C is unable to reli ably do so en masse.

Despite static code analysis, Valgrind, Tsan, and -Werror being available for a decades, there are scant evidence those tools There are achieved widespread acknowledgement, let alone widespread adoption. In aggregate, programmers has shown they simply cannot safely manage their own memory. It ' s time to move away from C.

Go does not rely on the programmer to manage memory directly, instead all memory allocation was managed by the language run Time, initialized before use, and bounds checked when necessary. It's certainly not the first mainstream language this offered these safety guarantees, Java (1995) is probably a contender For that crown. The point being, the world have no appetite for unsafe programming languages, thus Go are memory safe by default.

Developer Productivity

The point at which developer time became more expensive than hardware time is crossed back in the late 1970s. Developer productivity is a sprawling topic and it boils down to this; How much time does spend doing useful work vs waiting for the compiler or hopelessly lost in a foreign codebase.

The joke goes that Go is developed while waiting for a C + + program to compile. Fast compilation is a key feature of Go and a key recruiting tool to attract new developers. While compilation speed remains a constant battleground, it's fair to say that compilations which take minutes in other L Anguages, take seconds in Go.

More fundamental to the question of developer productivity, Go programmers realise that code was written to be read and so place the act of Reading Code above the act of writing it. Go goes so far as to enforce, via tooling and custom, which all code is formatted in a specific style. This removes the friction of learning a project specific language sub-dialect and helps spot mistakes because they just look incorrect.

Due to a focus on the analysis and mechanical assistance, a growing set of tools, the exist to spot common coding errors has been adopted by GO developers in a-the-never struck a chord with C programmers-go developers want tools to H ELP them keep their code clean.

Concurrency

For more than a decade, chip designers has been warning that the free lunch are over. Hardware parallelism, from the lowliest mobile phone to the most power hungry server, in the form of more, slower, CPU Cor ES, is only available if your language can utilise them. Therefore, concurrency needs to being built into the software we write to run on today's hardware.

Go takes a step beyond languages that expose the operating system's multi-process or multi-threading parallelism models by Offering a lightweight concurrency model based on coroutines, or Goroutines as they is known in Go. Goroutines allows the programmer to eschew convoluted callback styles while the language runtime makes sure that there wil L is just enough threads to keep your cores active.

The rule of three

These were my three reasons for recommending Go to my friend; safety, productivity, and concurrency. Individually, there was languages that cover one, possibly. These domains, But it is the combination of Al L Three that makes Go a excellent choice for mainstream programmers today.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.