Living The Examined Life

Socrates was a Greek philosopher who lived in Athens in 4th century BC during the infancy of democracy as we know it today. He is best known for his critical thinking and the Socratic method, which…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Getting Used to Go

Doing some Go coding

Introduction

I used JavaScript and Node.js at projects for last 3 years. I started as Angular developer at my first career, used Node.js in personal projects, and developed TypeScript servers. I really get used to Node.js. Not like guru but I’m sure I can implement many things from it.

After 3 years, I came up with one idea; Like I get used to Node.js and JavaScript, I should revisit “how to get used to some other language and concept”.

Why Go

First step was to choose what language to learn. I choose Go. There were couple reason for this.

First reason is that Go is good for server developing. These days, I’m really interested in server application developments and usually do server projects. Why I like to do server programming is there are much different systems to learn. Go has good server developing packages out of box. Compared to Node.js where you should download all the different packages before starting developing servers, Go would be pretty lightweight and not much to learn.

Second is Go outputs binary executables. I usually use Docker to deploy applications to servers since it ensures identical environment for application and it can be used as scalability and availability provider. The problem I experienced with using Node.js + Docker was that final output of Docker image is big. Since Node.js alone is big application, and its application sometimes required a lot of packages, its image sizes sometimes reaches almost half GBs. Compared to that, Go is much better. It usually has 2MB kind of image size when used with BusyBox or Alpine image(most lightweight linux image), makes it simpler to use with Docker.

Finally, I thought I should learn how to use typed language. Dynamic types of JavaScript was useful when dealing structured data with JavaScript Object. However, it also had some tradeoffs of performance and readability. Even if TypeScript provides some typed-like experience, it has limits. Go is static typed language, and I thought it could be a good option to learn how to improve performance and readability using static typed language.

Plans to Do It

How should I learn Go? I came up with these;

I like to start leaning new concept from top-down approach, which means starting from conceptual videos and tutorials, and deep down to official documents and other project references. For Go, I personally started with following;

These gave conceptual understanding of Go. I kept on going with deeper docs, tutorials, and reference projects.

Starting a simple project would be great boost up for learning. After doing some readings written above, I jumped right into projects.

Example of pregression

First project was ‘pregression’, at that time I was doing small project that process some historical data of cryptocurrency and predicts future price. The core was polynomial regression model and I decided to implement it with Go. I will posting ‘pregression’ and the prediction project later.

Second project was ‘bulk-download’. It is simple web service that takes URL pattern from user and bulk download and zip it to provide download. One friend of mine was suffering from this tedious task, and asked me if I can automate it. So I did.

Conclusion

Now I think I’m ready to do some real projects with Go. Like I said above, I choose Go because it is good for server, it outputs binary when compiled, and it is statically typed language. I did reading and watching docs and tutorials, conducted simple project myself with Go.

I’m currently doing some bigger projects with Go, and also I’m going to post those in another article. Thank you for watching!

Next Story: A Newbie Gopher’s Server Developing Experience

Add a comment

Related posts:

Decouple Infrastructure Code from Business Logic in Java

Make business logic cleaner by decoupling infrastructure code. “Decouple Infrastructure Code from Business Logic in Java” is published by Suraj Mishra in Javarevisited.

How to Fix a Photo With Bad Lighting in Post Using Adobe Lightroom

Bad lighting on a photo? Don’t toss it out just yet. You might still be able to bring it back alive. In this video, I’ll be walking through 9 easy steps to fix a photo with bad lighting in Adobe…

Meal Prepping

Meal Prepping is the concept of preparing meals and dishes ahead of time. It is really good for busy people as it saves a lot of there time. Also, it will help you avoid unnecessary fast food meals…