Hi, I’m Pavel!
I’m a software engineer in Mad Devs. In the past six years, I’ve been working with Ruby and Rails, also I love React and Redux. I was a happy developer because Ruby is a great language, which allows the developer to create many things easily and interestingly. You just choose a tool you want to work this, and it just works!
What am I doing here?
I’ve noticed something. People have chosen Go very often when they start a new project. I asked: Why? People said: Go is popular, modern, and trendy. But is that enough to choose a programming language to use?
Why Go is so popular
We should remember that Go is popular because of Google. Some developers just want to use Go, because it’s everywhere! Let’s talk about Go.
Go is a good programming language. Not the best, just good. Go-creators clearly defined the basic principles of language. Core-team developers are brave people, who don’t back down and improve language according to basic principles. It’s pretty hard because Go-community is very big now.
Unlike Rust, which interfaces sometimes are changed, and developers can’t compile after minor language updates, Go is very stable.
Who is guilty? Entrepreneurs, of course
Business is always to blame! Developers know the truth.
I’m joking, but…
I want to tell you a story. The outsourcing company has got a new client. The client wants this company to develop a web application. The client suggests using Go as the main language for the backend. Why has the client chosen Go? The client is not an IT company, not technical at all. It’s easy! Go was advised to the client by his developer-friends then the client made some investigation and recognize, how popular Go is.
Why companies use Go
Moments such as the previous story happens very often. Sometimes it prevents a good development process because the outsourcing companies won’t persuade the client. It needs more projects to get money. In this case, VERY BAD companies agree with the client without attempts to persuade. And they start to develop with Go, even if they don’t need Go. Count of Golang projects is growing, outsource companies increase their Golang departments. They motivate their programmers to learn Go. It can go on for a long time. When the count of Golang projects gets less, this VERY BAD begins to use Go in cases, where it’s useless. Because they already have a big Golang department. Count of Golang projects is still growing.
That’s why we have a lot of projects on Go, but many of them don’t need Go.
What is Golang good for?
Golang has its own scope of tasks, like every other popular programming language. This scope is built historically. It depends on tools and popular and successful projects, which were developed with a language. Sometime core-team developers have their own vision of language applicability.
In my opinion, now Golang is useful in this scope of tasks:
- Microservices. Of course, Golang is the most popular language to create microservices. But why? If you don’t know the answer, you haven’t written to Golang production :) I think that Golang packages allow developers to create microservices easily. When developers try to make good architecture with Golang on 3000 lines or more, they recognize that it’s not too easy. For example, in Ruby, you can add a module in one place of application and use it everywhere in a project. Golang doesn’t allow to do such magic. If you want to use some function, you should every time import package with it, in every file. This basic principle is about microprograms;
- Overloaded processes. Please, don’t mix up with the highload. The overloaded process is about one process, which needs to do many actions with data. Golang is very good at it. Creating difficult text processing with Golang is easy. Language has all tools and libs to make this process incredibly fast;
- System utils. Docker is developed with Go. It must be a reason why. I don’t have experience in development system tools. I know Docker as a user. Unfortunately, I don’t know why it’s so useful for system utils. If you have such info, please, share it in the comments. Thnx!
What is Golang not good for?
In my opinion, there is one very important point: you shouldn’t use to create REST API!!!
Well actually, you can use it, but only if you create REST for one model. If you need one action for many models, you shouldn’t use Golang. If you need many actions for many models, use Rails, Django, ASP.NET, Pheonix, Spring, etc. There are many great frameworks, which allow you to create REST faster, more secure and easily. They have stable ORM, migration tools, views, controllers, etc. Golang doesn’t have any full-featured web framework. Every time you need to create a web application from components, which sometimes do not match with each other.
Golang now supports Web Assembly. I don’t know how it will work. Stayed tuned.
Experience of using Go: advantages and disadvantages
These are my thoughts about language after three months of use. Just remind you about my experience. Six years of a development web application with Rails and React, I’m a full-stack developer.
The first impression of Golang disadvantages looked like this:
- They’ve taken away my favorite toys. No map, no reduce, there are not many other good functions;
- Type matching works fine for Go, but for Ruby developer, it shocks;
- Static typing casts down after years of work with dynamic typing;
- Poor default lib. It doesn’t have many needed functions for strings, numbers, and other types. For example, if you need to reverse a string, please, right it by your hand or search for a ready solution. I was sad. Now I appreciate these things in Ruby, JS, etc;
- It seems like I use C++. I felt this only first couple of weeks working with Golang;
- Procedure-oriented programming. I’ve forgotten how is it hard to write code in this style;
- No stable package manager. STOP! There are a couple, not bad managers. But after Ruby bundler or JS yarn all of Golang managers are weak;
- The interface looks like a kludge. Many developers use interfaces when are too lazy to write code without it. But it’s very hard to support;
- Poor code-convention. Ruby and JS developers have stable code-conventions. Everyone knows them. Unfortunately, we don’t have such a thing in Go. Golang-community doesn’t support one main code style, there are many different;
- No stable debugger. Yes, it is. I know difficulties with Go runtime. And why it’s very to create full-featured rich debugger. But I’m a developer. I need to create the best products. I need a debugger.
There are some good advantages with Go:
- Compiler. After six years with Ruby, it’s nice to have the compiler, which saves your ass sometimes;
- Everything is explicit. Golang doesn’t share context between packages, that’s when you the code, it works as you see. Because context doesn’t depend on it;
- Easy to write pure functions.
As you can see we have more bad points than good. But bad points are just emotions, besides good points. There are all about practice and architecture.
Golang is a good programming language, but only in the scope of applicability.