Showing posts with label Golang. Show all posts
Showing posts with label Golang. Show all posts

Sunday, December 27, 2015

Go Go Go: Golang is the way for me to go

It all started with this picture.

What do you see?

I see a happy environment with 2 essential elements.  All the characters are happy and there is food.  After all this is what I am trying to pursuit all these years.  A happy working environment and be able to provide food for the family.  

With these 2 things (happy working environment and food for the family) I have decided to learn this "new" language. An of course, I started with writing a Hello World program.  Even this is a simple program it provides some some insight as to how this language looks like.  In this blog post I am not going to dig into the language itself.  If you are interested, I will be presenting "Introduction to Go" on Dec 30 8:00 pm EST for Commitmas vBrownBag.  Once I got a link to the presentation, I will update the post to reference it.  Registration for the event is here.

So what are we to talk about here?

The purpose of this post is to have a glimpse of Go from a high level.

Go is developed in response to specific problem that Google encountered in software development and deployment.  According to Rob Pike one of the 3 original designers of Go along with Robert Griesemer and Ken Thompson defined Go as a:

  • Complied
  • Concurrent
  • Garbage-collected
  • Statically typed language developed at Google around 2007 for efficiency, scalability and productivity

These 16 words summarized what Go is cleverly and precisely. 

Efficient, Scalable and Productive

The Go language is created with the goal of being efficient, scalable and productive.  Google’s infrastructure is huge and some of the software that runs this infrastructure is also huge.  Even building the software image may take up to 45 minutes.  Imagine there is a one line change to fix a critical bug that needs to be deployed immediately. For the developer to make the change and build the software already takes 45 minutes and then go through testing and then another production build and then deploy.  The turnaround time is measured in unit of hours.

Compiled

I don’t know about Google’s infrastructure but one of the advantage of Go is that it works on Windows, Mac and Linux.  Once a program is written it can be compiled and run on one of the 3 platforms mentioned about.  This bring another point on Go.  It is a compiled language.  Python which make up of 99% of OpenStack is not compiled.  It needs a interrupter to run the code.  Compiled means the software will generate an executable and then being ran.  Compiled program run faster than language with an interrupter.

Garbage-collected

One of the build in feature of Go is "Garbage-collection".  This term is about memory management for the language.  The designer of Go see that lots of coding is done in the case of C to manage the allocation and freeing of memory.  If the language can ease up the mundane but necessary task of memory management, developer and spend more time effectively on the feature itself.  Another build-in feature of Go in memory management is how the stack is handled.  Stack size in Go is dynamic.  If more memory is needed for the stack a new block of memory is allocated and be used for the stack.  Developer does not need to worry about stack overflow crashing the program.

Static Type

A type describes how memory is used.  A type can be a integer, a string etc.  Type is Go is say to be type safe meaning the compiler at compilation time check the usage of memory variable and will not allow the developer to assign a string to a previously integer variable.  This can be done in Python and the designer of Go decided that this is "dangerous" and make sure the types are diligently checked at compilation time.

Concurrent

This is a famous feature of Go taking advantage of the multi-processor of the modern hardware for instruction execution.  I read somewhere on the web using a simple for loop takes 42 ms to complete a task and written in Go with concurrency take only 14 ms.  This is a deep topic and I will dig into this more in the future and for now we just from a high level, know that Go has the ability to execute the instructions faster thus fulfilling the design goal of efficiency.

A very developer friendly language

Besides what Rob Pike's explanation of Go, I have found that Go is really a very developer friendly language.  Go function is able to return multiple parameter and this makes debug much easier.

Go has lots of build-in packages for modern day applications such as JSON processing, networking or web processing.  This makes developer's job much easier and no need to re-invent the wheel.

Go has a rich ecosystem on tools as well as build-in testing and bench-marking support.  This helps to validate local function modification.  This testing and bench-marking support is also in line with DevOps or Agile programming practice.

Golang is the way for me to go

This is only a glimpse of the language Go.  There are much more to it but after looking at this language for almost a month, I have decided that if I were to learn any new language, Go or Golang is the one that I am going to pick up because it aligns with my programming philosophy and practice.
          

Monday, November 30, 2015

Nothing published this month - Did I stop learning?



Last night when I apply for the 2016 VMware vExpert program, I realized that I did not publish for the month of November.  This is the exact opposite of November 2014 where I participated in the “30 blog in 30 days”.


If you read the description of this blog, it said – “A blog to share security, networking and cloud related technology information as @vCloudernBeer picked up on his search for his destiny in the cloud”.    

Well does it mean that I did not pick up anything this month?  

That's correct, the answer is NO (double negative). 

What have I done?

Actually, I am learning more and thus I do not have time to write.  Blogging is important and it helps me to truly understand a given subject.  And it is fun to write and to share ideas, knowledge or experiences to the community.  It is for sure a win situation for me and I hope it is also a win-win situation for me and my audiences.

Another reason that I did not publish any post this month is that being a software developer for networking equipment, I am trying to find a job that is cloud related.  There are so many things/skill to pick up and I figure that I have “talked” enough and it is time for me to “do something”.  I need to work on some project and I need to be proficient in using GitHub for open source project collaboration.

I told my wife, to contribute to open source in my situation is just like trying to learn how to play a musical instrument from YouTube.  Everyone has the impression that it is open source and you just dig in and look at source code and then contribute.  What I have found is that understanding the code and even to make changes is not so difficult since I am a software developer.  What I found difficult is to create a testing environment to test my changes.  Unit testing is very important for software developers.  I am a true support of “Test Driven Development” methodology.  In practice I may not be able to follow this TDD methodology but I try to test my code as through as possible.  It is very important for me to create a test environment. I need to pick up more operator skill to augment my software development skill.

Instead of writing, I tried to follow the step-by-step guide that is available on the web and try to create for myself test environment for different projects.  I ran into equipment problems where I found that my home lab is not quite ready to create a stable open source development and testing environment.  This weekend, I will be converting my Dell T-110 that has 16 GB of RAM running Windows 10 from a hard disk to SSD.  After that conversion I am going to duel boot this machine with Windows and Ubuntu 14.04.   Well, 16.04 is coming and I better get my environment up and running soon.

Commitmas

In the month of December, I will not be publishing blog post much because I will be participating in a community driven event - #commitmas in which I will learn along with the community on how to be more proficient in using GitHub.  If you are interested also, take a look here and consider joining this community event either to learn, to teach or both at the same time.

vBrownBag (as always) is nice enough to host a series of special podcasts on different aspects or pro-tips of using GitHub.  I will be giving a presentation Dec 30 - Bringing it all Together - Intro to Go. And do join me and see how I did in presentation a boring subject.  You can register for the podcast here.