Go programming language – a first impression – 1

I’ve been feeling I should try a new software development language for a while now, to see what life is like outside C++, C#, Java and Javascript. I had a toss up between Clojure, F# and Go. I discounted Clojure because it compiles to Java byte code and I want to stay out of the Oracle ecosystem. I slipped into Go over F# because I could do the Go example without having to get a Visual Studio add on (I know I could do F# from the command line, but I couldn’t be bothered) and the first example worked first time.

I’ve run though the tour and had a play with a few examples. I’m going to reserve judgement on the language itself until I’ve run though Effective Go and fully understood some of the concepts I think are important. In general the language seems very clean and concise (especially compared to Java). The usual problem exists that the main work would be learning all the new libraries and ways of doing things, if I actually had to do something complex, I’d fall back on a language where I knew where to find things (maybe F# would have been better in this regard) because the risk would be much lower.

Something that I think will limit the adoption of Go is the fact that it’s really hard to search for jobs in it (even on Google). I was having a look to see if there is any uptake of it, but trying to search for “go” on JobServe gets you a load of posts requiring “go getters” which is really not what I’m after. If you use “go language” or even “go programming language” then your targeted as a go getting translator! I don’t know if there’s some code in the industry to get round this, like calling it “Google_go”, but until I find the key, even if it’s ace, I’ll never be able to find a job or hire anyone.

Anyway, next time a real bash at the pros and cons.

  1. True, some search engines will need to be updated. I remember first looking for C# and not finding anything of any use. The sharp character was being stripped off so you had to search on C Sharp and even then you’d get lots of C or C++ results. Then I realised searching on .NET was better, but I’m sure that also was a rubbish search term to start with since the search engines initially removed the full stop too.

    The problem with content is the lack of context. This has always been my complaint about the internet and trying to find anything useful.

    WordPress has tagging, so you could write a search engine to search all cycling tagged content, whereas other sites don’t. Most shops have context or categories, so you search then select a category or vice versa.

  2. I glanced and I decided not to bother. First impression, removing a few brackets and semicolons doesn’t make it any better than the language it is copying.

    And since when is
    var moves int
    better than
    int moves;
    var moves;

    But the final nail in the coffin was “You should never put the opening brace of a control structure (if, for, switch, or select) on the next line”. Yes, they’ve removed line ending character, so they are forced to implement stupid restrictions like this. I prefer the C style approach, like so:

    if (tim.IsBetterThan(you))
    throw new Exception(“Developer error, go and sort yourself out man”);

    Forcing me to use the Java style approach of:
    if (tim.IsBetterThan(you)) {
    throw new Exception(“Developer error, go and sort yourself out man”);

    Is just going to make it more difficult for me to visually matching curly braces. They should have gone down the VB route and enforced the “end if” syntax while they were at it:

    if tim.IsBetterThan(you) then
    throw new Exception “Developer error, go and sort yourself out man”
    end if

    I sometimes prefer the VB syntax, but given the choice I code in a C style language.

    • To be fair I put my opening braces on the same line as the control structure. I used to put them on the next line, but I’ve slowly migrated over time. Don’t know why. I think I drop back to the next line style for really nested logic. Not a deal beaker for me. I don’t think the style is the important thing about the language anyway.

      What I think is interesting are “channels” which is a way to do multi-threaded very simply. Also, the way you don’t have classes, but bind functions to strucs. I think it’s called “mixin”, but it makes extension very easy, they’re abit like partial classes in .Net. Also interesting how you can explicitly use pointers. I want to really explore these areas before I write them up.

      With your point about the name, I’m not sure the search engines will sort it out. The problem with C# was because the engines wouldn’t accept “#” as far as I can remember. That was a technical fix. Trouble is “go” appears on it’s own in the English language, unlike C. I know C# appears in music, but you’re unlikely to get a job advert where someone needs to be able to play C# specifically, or where someone needs to make good java (well, maybe in California).

      • Multithreading is difficult, getting it right takes some thought and design, but you ultimately end up with a far better outcome if the care is taken. I don’t think channels really change that and they can be simulated using (reset) event notification or delegate callbacks anyway. In threading volatile is your friend.

        C# has extension methods to achieve that if you wanted, but also in what way does it differ from C style programming (with the function taking in the struct as a parameter)?

        I can see I’m fixed with Java or C# as my preferred language and I have no desire to change that.
        Are there any performance stats for Go verses other high generation languages? What is the parser built in or is it compiled?

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: