Перейти к содержимому
Обложка сообщества Разное

Testing Golang

This post is just for myself. I am learning english, so in my opinion to learn something you need to practice a lot. Shortly, sometimes I am going to write posts in english here, forgive me for my bad english grammar :).

In the past, I wanted to change my life a little bit, so decided to learn new programming language :D. In a result, picked young language Go/Golang.

GoLang is very tiny language, even all language specifications can fit into one single page. Of course, I didn't mention about size of the single page :). Language Specification

What I like in Go:

1. Great tools, great decisions. Especially to compile&run, you just need to type "go run main.go". Also great tool "gofmt" - it formats everything for you, i.e adds tabs/spaces, etc... I think "gofmt" is useful for beginners, for one less responsibility to learn :) . I remember when I started learning programming, I didn't use tabs/spaces at all, but when I started to add tabs/space I understood how formatting is important. In my editor, Go formats a code every time on save (I am not sure whether it is by default or I did something to make it happen).

2. Static typed language that feels like scripting language. I like very much Python. But, on the other hand, at my work I see some difficulties with python if we were using Python instead of Java. It is refactoring. I think (I have't any experience with it) refactoring dynamic typed languages is nightmare. Compiler won't complain for you in the most cases.

So for big projects static typed languages makes more sense unless you have very good coverage of unit tests. If we come to Go, it took best of both worlds. It is statically typed but it feels like scripting language.

3. Very fast. As Go is static typed language and compiles into machine code, it should be very fast. I haven't such experiences with it, so haven't felt how much it is faster than others. But it should be fast as C++ language.

4. With less go more. Go is very small language. I spent 15-20 minutes to write my first program. I like when learning curve is very little, but can do many things with it. When I have many, many choices of ways to do one thing, it is headache for me. Fortunately, by using Go mostly you have only one way to do things.

5. Concurrency. Very well supported concurrency on a language level. It is very simple to write multithreading tasks. I think, this is the most attractive one for most developers.

With advantages it brings disadvantages, too. At first, Go seems like an ugly language.

If you are interested in examples of Go, in the next post I will write some example programs in Go. By the way, if you see any, please fix my grammar/spelling :D.

 
2
4
474

Еще по теме