Five reasons to go from Python to go language "translated 100%"

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

"Python is very powerful, especially Python3 has asynchronous functionality, but GO will completely replace its presence in a large enterprise ..."

If you really understand the quotes, you might want to try the Go programming language. I think go is a very simple programming language and adapts to any application environment, even simpler than Javascript programming, which is probably why the Go programming language will be popular in recent years.

Four Ming maniac Translator 2 months ago 0 People top Top Well translated!

What do we have before we use the Go language program?

The website treescale.com home page and API are Web applications based on some analytical tools. Here's our technology stack:

    • React.js Home Front end

    • Django Python Home backend and authentication services

    • node. js API Service

    • PostgreSQL database , Cassandra log System

    • Custom container registry is using the Rust language

From the above you can see that the underlying framework is completely based on microservices and logical separation (front-end separation), or even entirely different techniques to achieve.

Why we're starting to integrate API services and backend into a single project, the main reason is that they have a lot of similarities and programming through multiple languages or technologies, and the code has a lot of duplication. Ultimately we need to spend a lot of time in personalizing the Django ' s API service, especially in customizing the JSON response.

One months later we used Django to build the API service, and I feel it's great when you're developing some common applications that use Django, but when you need more performance and something that's personalized to the module, Django is going to be more and more complicated.

Four Ming maniac Translator 2 months ago 0 People top Top Well translated!

Why Choose Go language programming?

#1 compiled into a single binary

Golang is a compiled language and Googe developers have taken a lot of effort on it. It uses a static link that is actually based on the operating system type and environment combination of all dependent library files and modules into a single binary file, which also means if you want to compile your backend application to your Linux operating system and the X86 architecture of the CPU, you just download the compiled binary application to the server, Then the backend app can work, which is not required for any dependent files.

#2 Static type System

Type systems are very important for large-scale applications. Python is a great and interesting language but sometimes you see some unusual anomalies because when you try to use a variable as an integer, it turns out to be a string type.

# Django would crash process because of this Def some_view (request): user_id = Request. Post.get (' id ', 0)

Go at compile time tells you this is a compiler error, this is the place to win time on the silly question.

Four Ming maniac Translator 2 months ago 0 People top Top Well translated!

#3 Optimization

Surprisingly, in most scenarios, the Go language is faster than Python (version 2 or 3). The results of the comparison can be seen in the benchmarking Game, which is unfair, depending on the type of application and the user use case.

For our case, the Go language has achieved better performance due to its own multithreaded modules and CPU scalability. Whenever we need to perform some internal requests, we can use Goroutine to perform them separately, which is more than 10 times less expensive than the Threads in Python. Thanks to these built-in language features, we can save a lot of resources (memory and CPU).

#4 Go no longer requires a WEB framework

This is a very cool thing for programming languages. The creators and communities of Go languages have built in many native, core-language-supported tools, and in most cases you no longer need any third-party class libraries. For example, it has built-in HTTP, JSON, HTML templates, and you can build very complex API services without even having to bother to find third-party libraries on Github.

Of course, Go also has a lot of class libraries and frameworks for building Web projects, but I would recommend that you don't use a third-party class library to build your Web project or API service, because using native packages in most cases can make your life easier.

coderbruce translated 2 months ago 0 People top Top Well translated!

#5 better IDE support and debugging

IDE support is one of the most important considerations when you try to change the programming language. The friendly IDE can save you 80% of programming time on average. Go Plugin for JetBrains idea, also provides other support, such as (Webstorm, Phpstorm, etc...). This plugin provides any service you need in the development of your project, and the powerful jetbrains idea will empower your development.

Based on our code statistics, we wrote 64% less code after rewriting the project with the Go language.

you do not need to debug code that does not exist. Fewer code, fewer errors!

coderbruce translated 2 months ago 1 people top Top Well translated!

Conclusion

Go gives us super flexibility, one language that works for all user scenarios, and works well in all user scenarios. In our backend and API services, we have 30% performance optimizations. And now I can process logs in real time, convert to a database, and process one or more services through Websocket! This is the very powerful feature that the Go language feature provides.

coderbruce translated 2 months ago 0 People top Top Well translated!
Related Article

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.