Why GO is getting so much traction by Russel Winder

okay so why is go getting so much traction it’s obviously an interesting question is it good good this is what we like to see yeah I think everyone now gets that joke so therefore we can’t have any aims goals or objectives they’ll be far too much structure you’ve got to make it up as you go along yeah I don’t know of course a drives me around far too long now so it’s my way to pass a bit like most JavaScript systems so the basic idea here is really just to introduce to you to why go is getting a lot of traction as it says in the title because it is in the last six years I think we’ve basically had proof that node is dead so there’s no point in doing JavaScript there anymore I hope to try and prove why oh that we’re not supposed to do that verse sorry sorry about that if you want to do the full-on three day go course I work with these guys to do that we also do some free half-day ones and so go have a look at their website we’re being agile so I have no idea where the beginning ends and the middle starts and certainly no idea when we’re going to end except that someone I’ve lost my watch so if someone’s gonna have to make sure if you someone give me a five-minute warning I just wanted to put some context into my comments about God and I suppose we could call these the the school in university years sort of 60s 70s type period when Fortran was a real programming language because it was all in caps and then we’ve got some UCO years where we discovered that Fortran has lowercase letters in it and I was supposed to lay in cleaner has anyone ever heard of clean does anyone ever do any functional programming no okay so you it doesn’t matter that I failed to learn it when I was supposed to do which is why that’s in grey this is me spending three million quid of someone else’s money in startups so we keep that very small curve as a fail and having sacked twenty five people at three minutes notice I decided to just chill out for a while so I learned groovy D and Scala because it seemed like the thing to do at the time poor old fortress these these languages are going to be the other really important languages in life the universe and everything in my view especially this one and if you want to know why you can always invite me back yeah sounds good I don’t know that much t-shirt now you hear you see I started doing closure before go you’ll notice here there’s a mix a lot of functional programming a lot of dynamic language is a lot of static languages and that’s an important viewpoint on which to look at go from and people probably not heard of Ceylon and Kotlin yet and well one or two people have so Java is dead but that means I can rerun another talk for a few more times so that’s really just putting my comments and I’m always very opinionated so I just wanted to make sure that you got a little bit of context on where these opinions are coming from any officers what that one is a duck yes indeedy jesus knew but most importantly is a duck so let’s just have a few little intro points about go it is a replacement pursued once you’ve learned go you will never need to see again may accept sometimes when when you’re doing stuff really low-level really small things but most of the time see really is gone anymore GTC go yes he still need GCC but as we’ll see in two slides time there’s only one thing you need c4 and that’s ego which is to

connect go to see that it’s simple some people reckon you can learn go in three hours and you can probably learn some of go in three as but you won’t get the idioms of constructing really good go programs that still needs a few months actually any new programming language is going to take you a few months to get into but go is very simple you can get into it initially very very quickly and they don’t like C++ in goal and because it’s just too complicated and I suspect that also goes for languages like the ruts and any others that come along anyone got into rust until a crucially important factor in Ingo is in fact Rob Pike not necessarily individually but individually as well but it’s because of his research programs over the years from the sort of early 80s onwards there was a squeak I realized last evening I should have put squeak in here as well and hence new squeak which is programming language following on from it and the important thing about all of these languages is concurrency and parallelism where the two are significantly different and if anyone thinks concurrency and parallelism know roughly the same we need to talk and we’ll notice that the terms concurrency and parallelism in computing are completely different from those in natural language you think about it what does concurrency mean in computing doing one thing at once what does it mean in real world doing lots of things at the same time yeah I’ll leave the notes about inferno for a little while it will rise again you’re possibly asking yourself why is Aleph in parentheses well Pike wasn’t a main driver of Aleph he was a mentor on it but the three languages nonetheless formed the root to the go language if you go and look at the history of those languages and look at the languages themselves they are all fascinating interesting but not very useful will go is because it’s the language of now duck yeah go tonight yeah you can tell it’s a gold no because it’s got a golden eye actually you also need to note that it’s got a white bit there because there are ducks that look like that that have gone eyes that don’t have the white bit there go is very definitely native code there’s no virtual machines involved here on the metal so good stuff object-oriented much more object-oriented the java much more object-oriented than C++ in interesting ways because it doesn’t have inheritance and most people will say how can you be object-oriented and not having heritance yeah okay we can have a big long discussion about it and do the whole thing and and if you want it okay we could perhaps say object based here if you want to get sort of very 1990s about it yeah contentious point number one really is how can you be object-oriented without inheritance and for me and the reason really I started would go and I’ve been following it is the concurrency and indeed parallelism that’s built in to the language how many of you guys have got phones with 4 cores yeah most how do you manage the four cause you just don’t care we treat it as a device yeah so you know how many people think threads are a good idea how many people think managing the threads is a good idea the the backdrop to this is is again

about abstraction and yeah computer science is supposed to be about abstraction and we’re supposed to build our abstractions and use the right level of abstraction for a given problem we’ve got it and yet how many people manage stacks in their code nobody just let compiler handle it I mean why care will you bloody well chip care because in a very very small constrained system you have to know where your stack is and how big it is at every possible moment particularly if you’re working on smart cards you’ve got maybe 4 K 16 K of RAM and maybe a Meg of flash you need to know how big but you guys big systems I know big systems out here somewhere you don’t care about stack how many people care about the heap a little bit okay so in Java you say oh we’ve got two CMS or if you’re really up to date you say we’ve got g1 just let it get on with it some people care about the heaps for the same reasons very small constrained systems motorcars and things like that they care about size of people and things people build building on big Intel kit so why do you care about threads it’s just more infrastructure just let it be managed and that’s one of the things that go has brought front and center to native code languages is thread pools and having managed threads and that is absolutely superb absolutely it’s a serious mongrel this one and I don’t think anybody I know who’ve seen this I’ve shown this photo to could type that duck it’s a type ‘less duck this one’s even worse because this one is clearly part Mallard part something else and good grief and it’s from Fang Goffman whereas the other ones from London so bizarreness gets everywhere storyline of go 2007 and notice they worked in stealth mode for a while and then they made it public and you know most people sort of cottoned on to the language fairly quickly and I think that first London go meeting was somewhere around here and that was good fun and somehow go meetings always get pizza and beer I don’t know I actually know who funds it more on that in a moment it clearly it wasn’t until this point that it became acceptable for businesses to use go because nothing about a language matters except the version number and the point someone was making earlier do you need C to compile go no because it’s now a self hosting system as of version 1.5 so go is written and go which means you need a bootstrap which means you need one point for to build one point five and so on and so forth but that’s a sort of standard evolution with a programming language now this one definitely a squirrel and it’s definitely saying that the bird feeder is empty feed me and I think you can tell that by these sad eyes and the plea of feed me I’m heartless I tend to ignore them and they tend to not like me after that as you can tell there and but what is it that sort of engenders like and dislike how does one actually become popular in these games of programming and programming languages has a lot to do with it that’s marketing perhaps the single most important thing in pushing

languages you get early adopters who are influential and the go guys did exactly that they went out and got some well-known people to talk about the language and you’ve got to create a bit of a bandwagon for any language see did it over a period of years in the 70s and gos managed to do it in about 2-3 years there has to be an interesting reason why that has happened and actually I think is probably slightly more technical than non-technical that the speed of adoption has happened that go is has got appealing features many of them relate into that concurrency and simplicity but also it is replacing see and to a great extent some C++ some Python some Ruby so I think you put those four together you’ve got the beginnings of the reason why the go bandwagon took off so quickly and so deeply part of Google’s aim here was to solve their own problems internally they have a lot of different languages in there and they have a lot of C and C++ and they were having problems and I don’t know how offhand the comment was but someone was saying from where the Google team was saying the problem was that they’ve got so many interns that can’t program massively well they need a language they can program well in it sort of sounds about right somehow so I think there’s a grain of truth in that so the simplicity Ingo is there to make sure that interns can’t screw things up on the Google codebase and how many people actually understand C++ I think Jonathan Wakeley is probably the most knowledgeable person I know in C++ and even he gets it wrong sometimes it’s a truly complicated language and C++ has only just got threads in the language and in only 15 years behind Java and but that’s not real proper on ongoing concurrency so that’s what Google needed was a handle on the concurrency for the big data centers they also did something which was really very very smart and nothing to do with technicalities of the language they actually went out there and told people about it and gave them free beer and pizza and cuddly toys the cuddly toys are crucially important you can get the blue one the pink one and the purple one and I’ve got two blue ones and a pink one I managed to miss getting the purple one two weeks ago really annoying a groveler person who joins a bandwagon because someone rich and famous joins a bandwagon and they are surprisingly important people when you’re trying to make stuff popular because they create numbers they create noise out there and they get your ratings up on stupid indexes like tea oming which has sad influence even though it’s gratuitously silly number but this one I think was the master stroke having got a simple language having got some contentious features in it they shouted it to the world and said come and argue against us and boy they did and that created publicity and that created knowledge of the language because every borough said no they’re arguing about this there must be something interesting in there that’s a really interesting way of getting stuff done too deep marketing going on there so you might argue that the success of technology is more about the marketing than the technology itself and yeah there is some truth to that if it hadn’t been for the marketing that Google funded go wouldn’t be where it is now but likewise if they hadn’t got some particular individuals involved who gorilla-like got the technology into production it wouldn’t have had the base

of good product out there that people could use as exemplars don’t you just love how this particular animal is so well adapted to life in the trees the color well apart from the orange Lynx SAS duck so contentious point go is a systems programming language that has garbage collection now everybody in the whole damn modular three-fourths of programming language they wrote an operating system in about thirty years ago inferno they’ve got a virtual machine in there so it’s not no it’s not on the metal it’s not I think that’s the important thing that Inferno has got to save that pike sequence is that actually you don’t have to be bare metal to be doing systems programming and do you need bare metal to write an operating system it’s an interesting question keeps coming up on the list we go listen no one’s actually tackled it has yet written a full on operating system in go but it will happen and it will work we know it will work because inferno worked we know it worked because the experiments using modular three to write operating systems work it’s just that they didn’t get marketed those two as well the whole plan nine thing and inferno didn’t sell into the market there are no generics in go this causes amazing fights I think every two months someone says oh I’ve got this new way of doing generics and go yeah we’ve heard it all before they just haven’t gone back in the mailing list to see why the idea will fail and fail it will because it doesn’t match the simplicity level that’s the fundamental thing most generic systems have type systems that are too complicated before goes way of thinking of things the certainly more duplication of code so if you want something of instance something of floats you have to have it twice but there is a nice trick phandom that do you get nah we’ve got little babies this is a red-breasted Merganser in case if anyone didn’t know you can tell it’s a red breasted because it’s got a red head and the males have a green head but pictures of little baby ducks always get a half well except when they doing something like that so why all boil as well if it’s obviously down to duck typing the success of languages like Python rest on doing duck typing and I think that works with definition just looking around see if people think that’s a reasonable definition for for duck typing it’s all about run time you don’t care about compile time now a lot of people programmers who are used to strong static type languages can’t cope once you give them a dynamically typed language I mean live literally can’t go and that’s sort of quasi understandable but it would be better if they just got on with it and learn the difference between static and dynamic typing because they are completely two different mindsets you can’t use one line step reserve with the other language that’s when failure happens you’ve got to use the static mindset of the static language a dynamic mindset with a dynamic language but it’s not a problem you just got to use the right mindset at the right time but goes actually slightly confusing issue following on our our camel we’re using structural typing and basically means programming to interfaces there’s a more formal way of thinking about it is structural typing and structural typing and duck typing have some subtle in interplays they are different things because duck typing is all about doing things at runtime but programming to interface is structural typing allows you to do compile time

checking mostly and go has that one case where it actually has duck typing in there and that really gets people worked up and getting worked up is great because it creates market increased publicity and people moan about it but this is I think the one place where it’s going to take you three months to really learn go is to deal with this competition between static and dynamic but also structural this is duck typing we’ll see some examples in a minute I’ve already had a bit of a rant about the concurrency and parallelism and the explicit management so I did that a bit too soon I should have wait till we got this slide but it comes down to who’s using thread pools Java’s using threads I’m sure c-sharp must been using thread pools by now well C++ might catch up in another 15 years everybody’s using thread pools is the first port of call for dealing with concurrency and oh no hang on it no single threaded they miss the boat oh so I thought we need some code by now so I’ve only got one example I’ve been using it for eight years so seemed like a good idea have you noticed how these wonderful creatures understand point novice okay so we want to calculate pi and whoops what’s happened here wrong something’s gone wrong panic panic we need some font size is that there’s one thing you do know about NGO is that the braces are always in the correct place originally too much controversy the go compiler would read your code decide whether it was in the right format and if it wasn’t it would write it back and then compile that was an interesting period and then the compiler writers relented and said no the compilers not responsible for doing that go format is responsible for doing that and so we get the go format tool which informs your code how it should be formatted and writes it back and quite right too so the curly brackets are in exactly the right place if anyone thinks it should be on the line below you are wrong and there is no question about it because go format will tell you like it or lump it go format is actually very good because every go programmer on the planet uses exactly the same format there is no bike shedding you just have to lump it if you don’t like it or use another language okay so lots and lots of type inference going on here and so should in this 2015’s any language it doesn’t do full type inference is wrong so that’s Java gone and but go is completely fascist when it comes to having the type correctness of operations it just will not compile things that require in other languages implicit changes of type okay so yeah it’s code is coded see like I never say you could probably learn most of this level of going in three hours oh I suppose I should just indicate that this is a definition and an initialization so if you wanted to write it as vas start time equals you could do now you probably have to put a type in here as well and but nobody does everybody just uses the qur’an equals as definition and initialize because this is a variable so you can update this

value whereas this is a binding one time by not with the constant I know oh if I take that constant out you’d have to put a coat on in there however the sequential version is not very interesting the reason for showing this example is to have a look at one of the most important features of go whoops too soon is that about right for font size yeah there are no semicolons because they get inserted on the way in through the compiler so the compiler checks to see where it the Kimiko hood should be and then puts them in it’s a bit like Scala does that there are interrelationships between those things yes absolutely and it’s why you have to have else’s in certain places so here we are that’s it the one and only tool for doing concurrency and parallelism and it’s all you ever need you just spawn off a task it goes into the task pool and is part of the task pool that gets handled by however many threads you suggest go 1.4 and earlier the default was one and go 1.5 the default is supposedly the number of processes reported by the operating system and I’m having some doubts about the relationship between processes cores and Linux because this is supposed to be four cores according to Linux Pete’s clearly two cores with hyper-threading and anyone who’s done any benchmarking who have cores with hyper-threading threads are a waste of time on most jobs not all and can be can be good but on most heavyweight computations like this is a waste of time however that was completely irrelevant side comment so what are we doing we’re just saying I want some number of threads in the thread pool and then we make some channels if you want to think about them as a thread safe cues that’s a good start point it’s not a good finish point you need to think about it more about now there’s a good start playing that thread side cues and so we make a thread safe queue that is going to handle floats nothing else you can’t put anything else down there so strongly typed and then we get I don’t like for loops like this but it’s go so you have to have them simplicity is only one way of doing it oh and don’t try putting plus plus re either there’ll be a compile error but then we spawn off this job up here and we’re giving it a channel so we send into the sub process the end point that is going to feed in exactly as you would with queues five minutes I better hurry up there we go here we’ve got a channel we are sequential code that is actually really rather important by having a strong model of concurrency most of your code looks and is sequential code and programmers are beginning to be really quite good at writing sequential code concurrent code still a problem so a strong model of concurrency really important and that’s what we’ve got here we send out on a channel we then receive on the channel all of the coordination all of the synchronization is about the data travelling down the channels in this particular case no but we don’t actually worry too much about that if you need to do that there are easy ways of annular another quick example and I do a lot of networking mostly between my computer and my amp because my amp as well our camp told me it had actually it doesn’t have a way of controlling the

lamp from from the internet and so here I’m trying to just write a client to it now I didn’t want to show the client not with this little time to go I will show the actual I’m making a mock of the arcane because I don’t want to carry an AVR 600 around on the train I want to be able to test my code without having the EM this sounds like a damn good idea for a mock so I’m writing myself a mock AVR and we get to use all the fun stuff like struct we like structs do you like struts good good way of putting data together and we can do interesting things with maps so if you want a map you just have a map this period of date structure and we can create instances of these and values and so on and so forth and then we can have some functions this is not very interesting function but further down we get some interesting functions well yeah it’s gone away so let’s go over here for a moment into protocols because the the mock is just a consumer of the protocol package and so is the client just organizing the code into packages you do that for Java C sharp any other programming language and I just need the actual let’s do command code so I’ve got a lot of command codes that you can send down this is an enum done properly so okay they’re implemented as bytes so when they’re going to be bytes down the down the line but we are going to have a type command code and command code is not a byte if the type that’s implemented with a byte and so I’ve got all of these it’s now an enum okay great stuff what happens if I want to output a string representation of the enum well you have a tool for doing that go generate and this comes back to the point about making int and float copies of things you can actually do interesting things we’d go generate which is a pre-phase which writes source code based on tools and that’s an important message that came from the go format the compiler should do its thing and then there should be a whole load of tools around it giving time oh I’ll skim a little bit over that and draw to a close if any almost have a look at the code and go yeah they’re most welcome the problem for me is that I a PR 600 doesn’t work properly you have to get the APR 700 or the AVR 900 and as you can tell the numbers got bigger so the price got bigger well that’s true but I was rich when I bought him and then I ran out of money yeah okay these are some little rants about programmers and sort of gratuitous squirrel a completely gratuitous and absolutely no reason this one at all there’s plenty of reason for this one because did you vote for bulb now if you didn’t vote for Bob in the election I suggest you go to the vote for Bob website and have a look at why squirrels of all sorts have a bit of a problem and so do ducks and so do most living things in the UK however go is simple you can learn it to use very quickly but to use it sophisticated in the idiomatic takes a little bit longer because some of the choices have been made are very different there’s lots of controversy around the language but the controversies in the end just go over the heads of the development team because they are happy and confident with the way that NGO is going and it has been well marketed I think you put those three together and it goes a long long way to explaining why Joe is getting this much traction and it is getting a lot of traction CloudFlare Soundcloud all of these folks are basing their businesses on using go getting rid of PHP getting rid of Ruby getting rid of Python and putting everything in to

go and I will leave it at that point which I hope is about only 30 seconds over time