Golang: Common Criticisms

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
go is a very carefully crafted and opinionated programming her language with the Simplicity her being one of the language it designer principles go inevitably makes a few sacrifices along the way some of them have helped gain any popularity go now has others are still heavily debated till this day in today's video we'll talk about some of these highly controversial criticisms ago has received as well as the corresponding justifications on these equidisms if you agree or disagree on any of the following criticisms please do not feel shy to leave a comment below before we get started make sure to head to golangdojo.com to get your free golang cheat sheet that said our fellow her golang ninja Tommy here will give us a detailed explanation on these equiticisms on go in this video thanks Wallace hi guys it's Tommy the ninja here and let's get started one of the biggest criticisms on go would have to be its error handling in most decently modern and popular programming languages the try catch idiom using exceptions is the norm that is when we encounter an error in a program we throw an exception which will keep bubbling up until we explicitly catch and handle it later on in one of the Upstream functions in contrast goes error handling is pretty Primal when an error occurs in a function the function will return an instance of an error interface implementation which then needs to be handled immediately by the caller function with a nil check if we want to have the air to get bubbled up instead we need to do so explicitly instead of doing so implicitly by default with exceptions as you can imagine since we'll need to handle each error explicitly these nil checks can become tedious very quickly it's not uncommon to see 10 plus air nail checks back to back in many go programs luckily we do have a few ongoing proposals to fix this if you're interested we have a video on the channel going through these proposals one by one another criticism go has or used to have is the lack of generics for the longest time the lack of generics has been one of the biggest reasons why many developers hesitated to migrate their existing code base to go before generics we typically use interfaces plus type assertions to achieve the same result the function will take in parameters of type interface and perform runtime type assertions to ensure type safety as you can tell this requires an explicit boxing or unboxing hit for every access which can be a significant performance drag a few months ago the go team listened to the community and added generics to the language this was undoubtedly one of the biggest and most controversial changes since the birth of go with generics we can now use type parameters to indicate the type of the parameters passed in type inference to to implicitly set the type parameter type and type set to limit the types allowed for the type parameter we've done a separate video on the Channel with a lot more details so make sure to check it out the next common criticism we have for go is the lack of test assertions according to the official site go doesn't provide test assertions because developers often use them as a crutch to avoid thinking about proper error handling letting other tests run after one has failed so that the person debugging the failure gets a complete picture of what's wrong while this is a valid concern and argument test assertions are very common in other programming languages and developers are used to using them this has led to the development and the rising popularity of libraries like testify which offers test assertions and defeats go team's original intent next we have the lack of built and higher order functions like map filter and reduce in most popular programming languages you can remove negative values of a number set like this nice and tight ID to do the same and go we need to leverage generics declare a typeset declare a generic function remove negative with a typeset previously declared and then pass in the original number set as a parameter as you can clearly tell this is a lot more verbose which is a common theme in go programs unfortunately last but not least we have one of the most questioned decisions in go and that is the nil keyword which many have called another billion dollar mistake derived from Java's billion dollar mistake with null nil and go can cause panics which may crash your program it can be confusing because it's the default value for some built-in types but not the others heck sometimes nil isn't even equal to nil often a problem when dealing with error handling and the list goes on nail and go is a topic that deserves its own separate video with more detailed explanations so please stay tuned for that future video obviously these aren't the only criticisms go has received but the ones often mentioned by go developers and ones I've found annoying from time to time as well if you have other complaints about go please consider leaving a comment below and we may be able to make a part two of this video on your exact complaints but even with these criticisms some of them more valid than the others go is still my favorite programming language go is an ever-evolving language and the go team has had a pretty good track record of taking feedback from the community and making sound decisions to make continuous improvements on the language hopefully in future iterations the go team will address some of these complaints to some reasonable extent to make our lives as go developers a little bit simpler this has been criticisms on go before you go make sure to get your free golang cheat sheet at golangdojo.com forward slash cheat sheet like subscribe and turn on your notification Bell and I will see you ninjas in the next video foreign [Music]
Info
Channel: Golang Dojo
Views: 10,824
Rating: undefined out of 5
Keywords: golang, learn golang, go lang, go language, golang tutorial, go programming, golang for beginners, golang 2022, golang generics, golang error handling, golang pros and cons, golang nil, golang billion dollar mistake, golang functional programming, criticism, Nil
Id: sDPGUDg7a3A
Channel Id: undefined
Length: 6min 11sec (371 seconds)
Published: Fri Sep 09 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.