Going to Go

in Programming & Dev2 years ago

I have posted previously about some of the courses I have been doing recently online. Most of these have been programming related, but some have been in general IT skills that may be useful to me. My employer has paid for a Coursera subscription and I am keen to make the most of it. The courses have included:

The latter two were heavy going and I needed something a bit lighter. There is a third part to those that I will get to soon. I have heard a lot about the Go language. You will often see it referred to as 'golang' based on the official site, but also as this is easier to search for than the word 'Go'. Hive has a similar problem.

Gopher

Go was created by Google engineers relatively recently to make it easier to build some of the systems they needed with features like concurrency without some of the complications of languages like C++. It was also made efficient when it came to compiling.

I opted for this course that looked like a basic introduction. It is my impression that people who are totally new to programming might struggle a bit as some of the concepts covered are fairly technical. The language is a lot like C with lots of {} braces, but less need of semicolons. The way the code needs to be structured can cause a few headaches, especially with multi-line statements.

I was not especially impressed by the instructor. He knows his stuff, but he is not the best presenter for video lectures with lots of hesitation and he often had to correct himself. The syllabus is a bit of a mix as it covers some basics such as input/output and data types, but then goes off into things like JSON whilst ignoring writing functions.

It is only four weeks of lectures, but you can complete them at your own pace. The limiting factor may be the need to get peer reviews of your assignments by other students. The course forum is full of requests for these reviews, so it is fairly useless to get detailed help on other aspects. The assignments themselves are not too complex, but you are likely to have to do extra research to find the features you need. For example some call for text input, but the command described in the lectures cannot handle strings with spaces and you may need an alternative. Luckily there are lots of online resources available. I found Go by Example very helpful.

I have not really seen enough of Go from this course to tell if it will be useful to me. Some of the data structures are interesting, but you have to do another two courses to get to things like concurrency.

I was able to install the Go tools on Ubuntu Linux as a 'snap' package. That is all command line and I just used a text editor for my code. Executable files were around 2MB for my simple scripts, so I expect these is some form of runtime system embedded in there, possibly for when libraries are required. I think the language is fairly platform neutral, but then so are others that are commonly used these days.

Here is a simple program to print squares of numbers.

package main

import (
    "fmt"
)

func main() {
    for i:=0; i < 10; i++ {
        fmt.Printf("%d squared = %d\n", i, i*i)
    }
}

I will have to consider whether I do further courses on this language. I am not sure what I will need next at work, so I am fairly free to look at different options. I do like Python, so may do more with that. I need a practical project to get me fired up.

Sort:  

The one thing go has going for it, is the native concurrency primitives, very inspired by erlang, one thing that sort of drags go down is the fact that there is a lot of mutability.
In relation to python, go has this one upside that it is compiled and therefore runs faster at execution.

The right language for the job can depend on many things. Ease of writing can be a factor. I think experience of different languages helps you decide which is right.

!ENGAGE 20

Thank you for your engagement on this post, you have recieved ENGAGE tokens.

As you know, I don't code unless you class simple HTML as coding? I can follow a MAN page or a Wiki though. 😃 It's far easier to just Advocate FOSS. 🤣

Ooh, I was, many moons ago, part of the development team for the SuSE iFolder a precurser to Dropbox and Owncloud. I didn't write any code but did a lot of testing and bug submission.

I shared this post on Twitter to try and get your work in front of more people.
You can find your post and me on Twitter if you like? https://twitter.com/dick_turpin
I've also upvoted you and shared your content on Hive.
I read your post. No Bots were used, this was all done manually. Hope That Helps.


"If you don't have enough power or Crypto to upvote me; reshare me instead. Reshares are worth their weight in gold!"
Don't forget, you can upvote peoples comments too!

I've not been part of a FOSS project so far, but that could be interesting to do. Someone has to do it.

!ENGAGE 20

Of course, you have! You use a Distribution, you're part of the project. You use a programing language, you're part of the project. You talk about FOSS, you're part of the project. Great things are built by unsung heroes lurking in the background.


"If you don't have enough power or Crypto to upvote me; reshare me instead. Reshares are worth their weight in gold!"

Don't forget, you can upvote peoples comments too!

Thank you for your engagement on this post, you have recieved ENGAGE tokens.

Interesting, Go is a little more familiar to me (not that I can program in GO whatsoever) as I use a few things written in go like the Caddy Web Server. Sounds like this course wasn't as good as some of the other ones you have written about, which is a shame and like you said they didn't explain how to define functions (which seems pretty damn important)

Thank you for posting in the programming community!

At least it gave me some idea about the language. I can always investigate further. It looks like my next stuff at work with be in Python, so I will go back to that for now.

!ENGAGE 20

Ahh finally, a language I have some grasp on 😂

Thank you for your engagement on this post, you have recieved ENGAGE tokens.

I played around with GoLang a bit as I was using the following repo to troubleshoot a Mozilla root certificate sync issue.

https://github.com/Lukasa/mkcert

I believe I had been testing a Python certificate validation utility and it uses that Mozilla cert bundle but it needed to be updated.

I think I had been successful using mkcert. It was all for the SteemYaLater, blog backup initiative I ran a while back.

In any case, it seems to be an intuitive and elegant language and also is used for SiaCoin, one of my favorite crypto projects.

Good luck in your learning endeavors.

The usefulness of a language can depend a lot on what libraries it has. Python does well in that regard. I have not looked into what Go offers. I would like to find myself a little project around Hive. I will have a think about that.

I have looked at GoLand after learning the rudiments of Rust. However, I am allergic to the C syntax, being accustomed to the Pascal/Ada syntax.

Gimme "begin ... end" every day instead of "{...}".

Of course, this is my personal preference and I am not here to denigrate anybody's preference or to start a religious war.

It's a long time since I did any Pascal. I liked it at the time. Maybe I should look at Rust too. I have enjoyed exploring some different languages recently. The Lisp-type ones like Racket are different to what I am used to, but I want to be challenged. There is no perfect languages and I am not going to get into 'wars' over them.

I have never heard of Go before, but it kind of sounds like what Windows did with Powershell and Apple did with Applescript back in the day. That is pretty cool that you business paid for you to take these courses. If you haven't already, you should check out CBT Nuggets. They take some pretty technical stuff and break them up into little bite sized pieces so it is easier for you to process and remember.

Not heard of CBT Nuggets. Will have a look. Go is fairly widely used. There are just so many programming languages in use these days and companies may use them in specific ways. It can be hard to know what to learn as some jobs will want years of experience in particular things. I try to be adaptable.

!ENGAGE 20

Thank you for your engagement on this post, you have recieved ENGAGE tokens.

Looks very familiar in it's looks. I use a lot of Powershell these days...

with lots of {} braces

.. and lots of these.

A lot of languages are very similar, which can lead to confusion.

Racket was all ((())). Helps to have an editor that checks you have the right number of each.

Helps to have an editor that checks you have the right number of each.

I know what you mean, don't use Notepad.