Why You Should Learn Go

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so I wanted to talk a little bit about go and why I'm really excited about it and why I think it's going to be the next big thing and how it already kind of is um like how how Java used to be like a really big thing in the early 2000s um there's kind of like this big shift and you know I don't know maybe C++ was big and then we went to Java now we went to JavaScript and now we're going to go I think you know it's going to be a big uh shift and and how we write software which is really exciting and the thing is um considering programming paradigms is that of course there's objectoriented and then there's like procedural generally speaking you know imperative procedural um so things historically are cyclical um if you talk to anyone that's been around for several decades um longer than me like my boss is in his 50s he's been working as a software engineer for like 30 or 40 years or something and like I go to him and I say hey there's this new framework we build like angular applications I go to him and say hey there's this cool new framework where it's very hyper media oriented and server oriented and he's like wait we've been doing that for for years or we used to do that now we're more client oriented but like it's it's a shift so now there's HTM or whatever and it's like this new trend but that was how we began and and then like early 2010s there was like react and angular and then now we're shifting back so it went from very server how it started like simple HTML pages and then like maybe PHP or whatever on the server um and then you know very heavy JavaScript angular starting with angular and then react and then View and then but now we're going kind of maybe back to another shift towards the server but the the whole point is that things are cyclical so that's then what else is cyclical you could say possibly programming paradigms also are cyclical in that every language currently is object oriented if you consider like the top four are python JavaScript C and Java like those four languages are the same like if you look at if you learn one you learn all like they all have the same I mean they have the same like filter reduce whatever array methods they all kind of copy one another but they also share the same uh object-oriented patterns so those four languages that I mentioned are all kind of the same like I can't think of any examples off the top of my head but they all are very similar in the way that they they have object-oriented programming and classes and so on and so before all that before you get you could say like C++ was the first big object oriented language um right C with classes C++ um before that you just had like C which was very procedural and a lot of other languages were probably either procedural or functional um so we went from the beginning which was very procedural and like simple and minimal what we consider now to be and then it when like small talk was the first object oriented language but C++ was the first like if first popularized it in industry um and then a bunch of other languages followed sweet with Java C and so on but now it's like maybe we're seeing a shift back to procedural with go because the same authors the creators of c um like Ken Thompson um Brian kingham and Rob Pike like all those original Unix programmers in the 70s who created C are now uh working on go or they have been for the past like decade and a half like I think it was conceived in 2007 then it was open sourc in 2009 first release I believe in 2012 and then now it's being increased usage and adoption and it's maybe comparable to like Java in early 2000s with its popularity and usage so on the topic of performance I believe go is comparable to C and Java pretty much they're kind of the same like there's benchmarks that say one is faster than the other or um you run this certain algorithm then the other is faster than the other and it's like I don't think it's really worth comparing um at that point so it's very comparable to Java and C in terms in terms of performance I believe it's about 10 times faster than python and a lot of benchmarks that they ran um but I don't know performance like isn't really uh the whole point uh the whole point of go go is that it's a procedural language so it's it rejects the objectoriented Paradigm like object oriented being a problem solving methodology that subsequently is then how you organize your code right so instead of solving the problem directly um step by step in whatever way you would first identify the objects their attributes their methods or actions that those objects have so it's just a problem solving methodology it's just one approach to solving problems and how you would organize your code but uh so instead it's procedural it's very simple minimal just like C and it's basically the SE of the 21st century so to speak um again written by the same authors um as C in the 70s so considering those four main languages C Java Python and JavaScript um they're very similar the're very objectoriented but if you look at a talk by Rob Pike um the one one of the creators of go he mentions that he goes to these programming language talks like JavaScript C he goes to um conferences and he mentioned that all the Lang languages they actually copy features from one another so they're very similar and there's a reason for that um so they why do they copy features from one another um maybe because it's like oh python has a a filter and a reduce now now JavaScript needs that too to to P or something like that um you know like if we don't have these features then we're going to lose market share and we're going to not have as many people using our language um that's possibly the the logic behind it but either way um if there then increasing features and so one language gets a new feature oh we really like that now all those three other languages are going to adopt the same one that means they're growing in complexity um while simultaneously becoming more similar to one another and that is bloat without distinction in the words of Rob Pike which I really like um so go is an Unapologetic boring language with an intended lack of features that's what I like the most um and what that means is uh it is non-expressive or it's minimally expressive like there is many languages like typ script like I deal with a types script codebase in my internship which is a very expressive language um there's a lot of ways to like write some code that does the exact same thing um and what that means is you can get very clever and have like these on liners that do something that could have been six or seven lines um and that's very nice for the person writing it but not very nice for the person reviewing and like refactoring the code um like a year later or something or several years later when the language changed and now like some features are um either maybe like deprecated or maybe there's like a new way that we do this pattern cuz there features change um so with go it the whole point is let's have as little features as possible and keep things as simple as possible so that like you could have some guy wrote write an entire code base and like 5 years later um refactoring it is like easy um and there's also um the whole thing about reading a file uh top to bottom so often in OB objectoriented um you're tracing methods and tracing uh where things came from like control click and that makes it pretty easy to do that um but I don't like tracing files like if I have to see where a method uh was inherited from and then this method um also contains a variable which was imported from another file um and then another file subsequently like it's just a lot of tracing back and forth like I'd rather just have one file that I know what's going on top to bottom and I think that's an important point of go as well so from some of my previous writing which I believe was from uh this came straight from like a research paper of that biscuit OS like this um operating system written in go go um but there's like four points um so there's four problems with C because again go is just kind of an extension of of C you can think of it um at a service level being very similar to C um under the hood it's like way different and there's like a garbage collector and all these different things but on the service level it's very similar to C and we can see four main things that are addressed um and kind of solved with high level language features being one uninitialized variables two out of bounds so in other words if you have an array um with like indices 0 1 2 3 4 um but then you try to access a point it into see like six or seven that's out of bounds um and that would cause like some kind of error in see but there's bounds checking and go which solves that issue um and then three use after free so like can see you would uh like malic and then free so memory allocate um you know X number of btes and then free it afterwards um that's like very lowlevel like close to the hardware managing of memory which obviously you don't have to think about that at all with the garbage collector um going on with pretty much any language has that nowadays but um read or write to unintended object memory safety bug I'll have to figure out what that means um finally number four is prevented without the use of pointer arithmetic so pointer arithmetic I don't even think they recommend that in C++ now like they have like smart pointers and like I don't even know what they're doing in that world but I don't think pointer arithmetic has been relevant for like a long time so though there is no pointer arithmetic um pointers are allowed and encouraged and go now this of course reminds me it with this bounds checking and like these highle language features that make your the life of the programmer easier um with like garbage collector balance checking um like all those things are nice um and they improve productivity at the cost of like CPU performance like there's it has to do all this stuff for you so therefore it's going to be a little bit worse at performance um so if you wanted to actually prevent the bounce checking um you can actually like dig into the x86 assembly and kind of prevent these highle language features yourself say if you were like building a game engine and you wanted to like squeeze out as much performance as possible um but that's a whole another topic for like another video and that's really a video that I saw of another guy he was comparing Russ to go he wrote a game engine and like go and then was comparing something out maybe I'll link it but either way um so if you're interested in go go and actually want to learn it um you can kind of either there's two paths I guess or two options like either one you like know a language or two like python JavaScript C doesn't matter um if you've like known other languages like it's not that hard it's very simple and you don't need to learn anything like it's just you start writing in it and read the documentation and Google stuff until you um get a hang of it um in the case that like you are very inexperienced and kind of like a beginner then I would highly recommend uh this book right here I think I just printed out a PDF um but it was it's written by uh Brian W kingham which he was an original Unix programmer in the 1970s who was the author of the C programming language book the original one um and I highly recommend that I'll link that um as far as just a free pdf online kind of a book you can read um but as far as what I did I was just like I was just kind of ding around and wanted to make like a game I just make like ter terminal based games so this is maybe something I'll show off one of the things I really like about go is that structs make it very easy to organize just just records you know like little bits of data you make a template of like what you want an attack to look like if you have like if you're building like a Pokemon game or something you have like an attack you have a PO Pokémon itself and an a given attack would have a name which is a string damage which is an integer attack type which is you could make that a string as well and like in Python I don't really know how you'd go about like making a simple template like yeah I know there's classes but like that seems overly complex just to make something like a very simple template or or uh I don't know collection of data members right um I don't really like that and I kind of like the whole um um concept which again goes back to C um it's very very similar to C if you've read c um go is like sometimes almost the same so as far as Loops um there really is no while loop um there's just four just f o f r four that's it there's no do while while for each I mean you could build your own for each if you want um there is something similar to Python's enumerate but it's all using the four uh keyword and this is just a simple switch case where like you're given an option to choose a starter um and that function will be called in main so as far as actually having an attack in a Pokemon if you have a struct that was defined previously you can then fill I guess a variable or really a struct um with that template and actually fill it with data here so here's one of the things I really like about go which is pointers um pointers are just like literally just pointing to a memory address of another um location or variable um so like any variable um is in a place in memory um like the data is there but it's also it exists in a address right so you can have another variable that stores a pointer to that address and so anyways um if you were to make a map um any map in any game um each location is is like connected to other locations in like a graph kind of way um and so if you first create kind of a template that's struck of what a location looks like it can has a name of course um but then it has connections to other um locations that it kind of branches off to um that's just an array of of other locations it's an array of um similar uh structs right cuz they're lo location stores in array of other locations and so that was like the template when you actually want to fill that data with um well towns and routes and different locations you can just um call Ampersand is address of same in C that little amp say address of location Pallet Town is at the address of location um and it's name is Pallet Town right and and then you just append um connections um to each one of those locations being other locations and then you have the entire game map which is a collection of all those locations U so here we just print out every location and it's connected locations um it's just a little nested for Loop um and then that'll look something like this as far as the game itself it's uh it's probably like 100 lines of code if that um and it's just kind of terminal based you know select one two or three um as your options and it's little fun project but yeah definitely play around with go um I enjoy it I like the history of languages and stuff like that especially but um if you are sick of like P typescript especially and like very expressive languages just want something very simple and minimal um that won't change ever um I'd highly recommend go so yeah thanks for watching
Info
Channel: Joe Bulfer
Views: 12,396
Rating: undefined out of 5
Keywords:
Id: YtlcGTFBEx4
Channel Id: undefined
Length: 17min 35sec (1055 seconds)
Published: Fri Mar 29 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.