Thursday, September 5, 2013

First impression of Golang

I have been playing with Go for 2 weeks. Here are my first impressions.

Good things

  • Concise and clearly expressed syntax - Its syntax smells like C and Python. It also has some small interesting improvements over typical C-family languages. 
    • if with a short statement. It might be just a syntactic sugar but I think it makes the code more concise.
    • I like the idea of having only for loop and C's while is a version of for
    • Capitalization means it is exported. Very simple and good formatting in the same time.
    • switch with break by default.  Yeah. It's arguable but break by default is my choice.
  • goroutine and channels - After I have been busy with thread-safe and concurrent issues using Java and Obj-c for a while, synchronized block, locks, java.util.concurrent, GCD and dispatch_async(), etc. I think this is another simple and amazing abstraction to deal with synchronization and concurrency in addition to a single thread and event-loop in nodejs.
  • Easily add methods to almost any types even function
  • Interface are satisfied implicitly - This is a 'wow' for me.
  • Toolchain included - testing, package management, formatting and documentation. This helps Go developers to have a uniform development flow.
  • Only one style and consistency - go fmt forces some styles and convention such as tab indentation. You might be annoyed if your preferred style is different from what the Go team has chosen. While I'm writing this, I found a very good explanation on why this is a good idea.

Interesting but in question

  • One place for packages - Go needs every packages to be under GOPATH and wants developer to avoid local/relative import. It provides a good structure for that. It needs to specify fully qualified name in code when import a package. For example, import "github.com/teerapap/mylib".  It seems to be a good idea but I wonder if the url changes. Do I have to changes every import lines in my code?
  • No versioning on package management - As opposed to npm, go get just get the latest version. I'm not sure if it is a good idea. Some said that you have to snapshot your tree. Some said that you need to use versioned path /v2/mylib instead.
  • Only static linking

Finally, I am very new to Go so I have no comments on speed/performance aspect and I am still not sure what Go fits but it is quite fun to explore the language.



2 comments:

  1. 슈어맨 다음드 먹튀다자바 공통 추천 토토사이트 메이저사이트 안전놀이터 가장 완전하고 정확한 먹튀검증 3대사이트에서 공통으로 추천하고 있는 스포츠 배팅사이트라면 안전성이나 신속 정확성에서 타사이트에 비해 앞서 있습니다 토토파워가 이를 공개합니다 안전 공원.

    ReplyDelete
  2. 안전놀이터 | 토토사이트, 놀이터추천, 토토사이트추천, 안전넷, 사설토토추천, 토토 안전공원, 사이트추천, 메이저놀이터 등 보증사이트를 제공합니다. 이제 여러분들은 신세계를 경험하실것입니다 자세한 내용은 여기를 클릭하십시오 안전놀이터.

    ReplyDelete