Learning Go from a PHP developer viewpoint

Learning Go from a PHP developer viewpoint

Finally, I have chosen a new programming language to which I will devote my time.

Don't worry, PHP is still my primary programming language and will stay so.

Believe it or not, but PHP is not the first programming language that I have learned. I can't remember exactly the correct order in which I came in contact with different programming languages...

My journey with programming languages

I think that the very first programming that I have done was on PS2. It came with a demo disc which had some sort of a program which enabled me to draw some 2D objects on the screen using YABASIC.

It was all very interesting to me... I started reading the documentation, checking out the examples and finally wrote some code which displayed a square or something like that. I dreamt of making a full game with it. Needless to say that I didn't get far with it :)

My next contact with a programming language was Python. It was a very brief contact. I was in high school and I have just heard about Linux. I dual-booted my laptop with Mandriva Linux distro.

Mandriva came with Python already installed, and that is where I have first learned about the existence of Python. Nothing fancy, skimmed the docs, followed a guide from its website and that is it.

During my college years I have learned a huge amount of programming languages:

  • C
  • C++
  • C#
  • Python
  • PHP

That was all in 3 years time. At that time I really liked C, since it was the first language to which I have devoted serious time to learn. I wrote a hangman game in C when I was working over the summer. The business was slow.

Also, I wrote a very simple program that I have tried to publish on Fedora. It was a very small and useless program, but I wanted to learn how it all worked. I forgot to mention that! I was running Fedora for the whole summer on my netbook. It was a Asus eee pc 1000.

C++ was a nice improvement over C. C# was the next step. I made a Windows program with it for recording exercise stats in XML files. Later, I started some basic web development with C#. Had a working website and at the end of my first three years in college I made a switch to PHP.

When I have learned Python, I have immediately fell in love with it. The syntax, the possibilities and it worked on every Linux distro. I have made a program with it, which we used during the exams to communicate over the LAN when the professors disconnected us from the Internet. It had a working GUI.

I even created Python scripts which installed and configured firewalls, DNS servers, HTTP servers and etc. I have copied the scripts to a virtual floppy disk which we would then attach to the virtual machine in which were working.

When I graduated, I told the professor of my special virtual floppy disk and the local network chat program.

He was very surprised about it at first, because nobody before has ever done that in his class. He later gave me some pointers and tips on how to improve the chat program. Cool guy.

What I wanted to say is that I really liked Python. During my professional practice I have continued working with Python on building APIs and web applications using Flash and Django.

When I completed the practice, I stopped programming for about a year. Then I picked up plain PHP and started working with it and learning and improving. I started learning about Codeigniter at that time. A few years later Laravel 3 came by and I built my first application with it, which still works even today and is being actively used.

Then came Laravel 4 with which I have built some incredible web applications. And finally Laravel 5.*, which I consider the best PHP framework.

Not mentioned programming languages

During my college years I was interested in building small robots. Here I came in contact with Arduino (I am not sure about this. It was a small microcontroller or microchip which had a limited number of lines of code which I had to code).

I made a small robot which went forward and when it hit something it would reverse, turn left or right and then go forward again.

I had fun with this project. I called it "Little 8".

I meddled with node.js here and there. A script or two from time to time, nothing serious.

There were other programming languages, but I can't remember which now... Maybe later.

Let's get back to the topic.


PHP is great and all, but for a year or two now I wanted to learn something new. From time to time I would lookup different programming languages and compare them to PHP. I would look at the syntax, the documentation, projects built with it...

When determining which language appealed to me the most, I was guided by a single thought: "How simple is it to build a website with it?".

Because Laravel has spoiled me, it was a very hard pick.

With Laravel you can do everything and its documentation is almost perfect. I mean, the documentation is not only there for reference, it is educational. By reading the Laravel documentation you can learn PHP. Toping that was a demanding task.

Programming languages which appealed to me the most:

  • Ruby
  • Python
  • Node.js

Ruby has Ruby on Rails. Even the birds sing how great it is. I hear that Ruby as a language is also very powerful and beautiful. There are two things that I don't like about Ruby:

  • The documentation for ruby on rails looks old. It does not look appealing to me at all.
  • The syntax for ruby looks very odd to me.

Python is very dear to me. The documentation is very good, I have worked with it before and it feels familiar to me. There is one huge thing that is bugging me with Python and that is that there are still two versions in active use. You have python 2 and python 3, and it bugs me to hell and back. I have learned both and I confuse them all the time. Then, there is the fact that you will have a very hard time getting pip and virtualenv running on Windows. You will probably get them running, but at some point you will hit some Windows limitation.

Node.js was my favorite in this roundup. Javascript on the backend. Who would not love that. The idea of it is very appealing to me. Nowadays you have Node.js everywhere. Npm is great when it works. There are a huge amount of frameworks and packages for almost everything. The main advantage of Node.js is also its main disadvantage. Javascript is ok. You can build cool stuff with it. Since ES6 it feels good, but :) Whenever I am working with Javascript I feel like I am writing code from inside the asshole. Everything is asynchronous and there are callbacks everywhere and variables can be objects, functions or variables. Things can get very nasty very soon.

Maybe my understanding of Javascript is not so good. I love it, but I hate it. That best describes my relationship with it.

As many times before, I would have forfeited the quest for a new programming language, but this time I was attracted by Go.

I skimmed over Learn Go in Y minutes and it looked promising at first. I have then read a few blog posts about it. Testimonials from other PHP developers that have jumped ships and one article on Medium where the author suggests that you start by using Go and not start by using a Framework.

After I have read the Guiding principles in the design of Go, I fell in love.

Needless to say that the winner is Go programming language.

Life from now on

I am currently still learning the language. The documentation is very user friendly. You can find everything there step by step on how to learn Go. That is very nice. I am currently at lesson 2 of "A Tour of Go" and then I plan to read "Effective Go".

My end goal is to be able to build an RESTful API with it.

Don't get me wrong, this does not mean that I am jumping ships. This only means that I am going to invest time in learning Go.

With PHP I am at a level where there are only complex things left to learn and I feel like the simple things are getting to repetitive.

If I had to start a project today, I would create a new Laravel application and start coding. I am very fast with it and can do wonders. Laravel has everything you need from a framework and then more.

Before you Go

This has turned out to be a very long blog post...

The things that I like about Go so far:

  • Code formatter included
  • Easy to get started with
  • Nice and fresh approach to repository handling
  • Documentation and packages sites
  • The community is very positive
  • Code is very clear

Maybe I have forgotten about a few things. I will surely write more blog posts about Go so stay tuned.

Oh yes! Let me give you some very cool links: FromXToGo and Success stories. These contain articles from people about their experiences converting to Go and Success stories. Very interesting read for any programming language to have.

I hope that you have enjoyed this article. Follow me on Twitter or send me an email. I would love to hear from you.

Mario Bašić

About Mario Bašić

Sometimes backward to move forward. Always.