My opinion on the programming of Golang

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

My opinion on the programming of Golang

Study for two months of Golang, grammar is basically mastered, from a C + + Programmer's point of view, put forward some of their own views it.

1, not a good package management tool.

I use glide package management in the company, the advantage of this tool is that you can choose a different version based on the hash value that git commits.
There are 2 questions:

    1. After each execution of glide init, you need to manually modify the version number in Glide.yaml, otherwise there may be an issue with API incompatibility.
    2. Because some libraries need to download from Google official, need fan Qiang, each time is relatively slow.
      Do not know why Golang not directly like Python, in the tool directly from the package management. Or, just like C + +, the programmer can do the package management directly.

2. There is no object-oriented inheritance, encapsulation, polymorphism.

Golang, as a programming language that appeared in the 21st century, provided interface and structs, but did not provide inheritance, encapsulation, and polymorphism.
The inheritance relationship is represented by an interface, for example

//golang type IParent interface {    func Print()}type Son struct{}func (s *Son)Print() {    fmt.Println("i am son")}

In the example code, the son realizes the Iparent interface, which is different from the explicit interface implementation relationship with Python,java,c++, and the Golang interface implementation is implicitly described.
If son and Iparent are in a different source file, or even in a different library, let the programmer find out that this correspondence is unfriendly to the programmer.

3. Language features not used

As a server-side developer, because our system uses a microservices architecture, the code for each service program is very brief. But in this short code, I never found the code that used the channel and go routine. I don't know if these two features are more difficult, so no, or because our program is too simple to use. As a C + + programmer, it's not as if you're writing C + + without the template feeling.

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.