8 ms·
> Ignore comments about how go is simple to write. There's a fair amount of bad go code and people break rules all the time. This is one of the most famous str
by hnlmorg 6y ago
> Ignore comments about how go is simple to write. There's a fair amount of bad go code and people break rules all the time.
This is one of the most famous straw man arguments made in software development and I've seen it used against a plethora of different programming languages -- each time completely missing the point that you can get bad developers writing bad code in any language. The fact it happens in Go isn't a testament not to how difficult it is but rather how good of a job the language has done attracting newer developers.
> Go is not a simple language. Please learn from my mistakes, and ignore arbitrary metrics like how go has fewer keywords. The complexity doesn't go away, it's hidden away somewhere.
I completely disagree. Having fewer keywords does make Go simpler to learn and simpler to read other peoples code. The opinionated nature of Go also makes it simpler to collaborate.
Writing software isn't simple but that complexity of turning ideas into code doesn't change significantly from one language to another (generally speaking). You still have to solve a problem using logic and functions. I find the harder problems with software development is collaboration (eg ensuring everyone is following the same coding styles) and reading back old code. Go makes those things easier than some -- not all but definitely some -- languages.
I say this based on 30 years of experience writing software in more than a dozen different programming languages.
- deleted 6y ago[deleted]
- doublerabbit 6y ago> Having fewer keywords does make Go simpler to learn and simpler to read other peoples code I partly disagree. It might be easier for you with 30 years of experience. Sysadmin with 8yrs of experience and having to manage operations utilizing Go is not easy. The code looks neat on the page; under the hood is really un-understandable at times unlike Perl, Ruby, TCL where the code is staring you in the face. The importation of modules off github is fundamentally wrong too.
- hnlmorg 6y ago> The code looks neat on the page under the hood is really non-understandable at times. Unlike Perl or TCL where the code is staring you in the face. Are you able to elaborate on this a little more? I love Perl and in fact that was my favourite language for a long time (despite all of its warts). But languages like Go are a lot more explicit that Perl so I'm not really sure what you mean by "under the hood" and "code is staring you in the face. > On vent: I also really loathe importing modules off github. I must admit that really annoyed me too but in fairness it's a pretty common pattern (eg brew, npm, etc). In a way Perl (CPAN) is an edge case rather than the norm. The difference is other systems add a shim around the code source even if they do still pull directly from (or from a cache populated directly from) Github et al
- doublerabbit 6y agoSure. We use Prometheus exporters, most of the exporters are written in Go. And this is a snip from the vmware-exporter for our VMware estate. metrics.go The first throw was this: import ( "context" "github.com/prometheus/client_golang/prometheus" log "github.com/sirupsen/logrus" "github.com/vmware/govmomi/find" "github.com/vmware/govmomi/view" "github.com/vmware/govmomi/vim25/mo" "github.com/vmware/govmomi/vim25/types" So as it currently stands I have no idea what those modules are and what I am loading. Browsing each of those repos sure will tell me, but that's not my role. My role is to make X operational. And if that repo doesn't exist anymore and you go to compile, it fails. More overhead if I need to make changes to any of those modules. I would need to git clone it somewhere, make the change and then either recommit it to git, or do something to make it locally available. At least with NPM, CPAN they are local to the file system. So lets start: var ( prometheusHostPowerState = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Namespace: namespace, Subsystem: "host", Name: "power_state", Help: "poweredOn 1, poweredOff 2, standBy 3, other 0", }, []string{"host_name"}) I understand all of that. Power_state, display the help, power status description etc, however prometheus.NewGaugeVec -- Sounds great. What is it? Where do I find this? What module is this related too? That's where it falls down for me. I now have to duck in to the rabbit hole of github to find out where that function is phrased and in this sense "under-the-hood" could also count for library .pm files in perl, but now having to navigate GitHub really messes with my workflow.
- jcelerier 6y ago> Having fewer keywords does make Go simpler to learn and simpler to read other peoples code. that sounds like saying that latin-alphabet languages are easier to read than chinese or japanese because they have fewer characters. the complexity just goes in the way those characters are assembled together.
- hnlmorg 6y agoFunny you should use that as an example because one of my lockdown projects has been to learn to read simplified Chinese and I'd say your point about Latin-alphabet languages was also true despite it being intended as a falsehood. Learning all the different Hanzi is immensely harder because of the number of characters and how intricate they often are. I'd also say that last point means it's also easier to write Latin characters too.
- jcelerier 6y ago> Funny you should use that as an example because one of my lockdown projects has been to learn to read simplified Chinese and I'd say your point about Latin-alphabet languages was also true despite it being intended as a falsehood. but that's because you come from a latin background. I lived with a japanese girl for a long time and she was adamant that kanji were much easier and faster to parse for her than western text
- hnlmorg 6y ago> but that's because you come from a latin background. I lived with a japanese girl for a long time and she was adamant that kanji were much easier and faster to parse for her than western text You could make your same argument here and say "that's because she comes from a Japanese background" ;)
- jcelerier 6y agobut that is precisely my original argument. in the end everyone finds "simple" what they're accustomed to, and you end up with more-or-less the same amount of complexity overall, no matter the system used to express logical thoughts, if you let humans try to optimize it over decades (but systematically, for programming languages) or generations (but less systematically, for spoken languages). I'm mostly programming in C++ and I find understanding what happens in some Python scripts much harder than some template metaprograms I've worked on for instance.
- preommr 6y ago> This is one of the most famous straw man arguments made in software development and I've seen it used against a plethora of different programming languages -- each time completely missing the point that you can get bad developers writing bad code in any language. This is a fair point since I wasn't very clear, and I am talking about something that's fairly subjective and abstract. I think the more claims a language makes, the more open it is to failure. I just googled is "rust difficult to learn", and the first answer is "no". It's all relative, but I am sure that most of us have heard that rust does have a steep learning curve. The only other language that I can think of that advertises itself as easy is python. And I think it has a lot of faults in those claims too. But python does a much better job of being easy than go does. It's completely different leagues. Again, this is a messy point to make, either somebody understand what I am trying to say or they should leave it at that because trying to qualify ideas like this is fuitless. > I completely disagree. Having fewer keywords does make Go simpler to learn and simpler to read other peoples code. I really don't think skipping keywords like public and using casing makes things simpler. A quick google search shows that go has 6 less keywords than c. I mean, c'mon... > I say this based on 30 years of experience writing software in more than a dozen different programming languages. If you've had years of experience in old school c/cpp, then (I would assume) go will be a lot easier, and a lot better in comparison.
- hnlmorg 6y ago> If you've had years of experience in old school c/cpp, then (I would assume) go will be a lot easier, and a lot better in comparison. In my opinion old school C++ was a lot easier to learn than modern C++. I'm talking about the language specification specifically. The tooling is undoubtedly better. Visual Basic 6 easily wins the "easiest language" award in my opinion though. But it's often seen as a faux pas to mention VB amongst developers
- croes 6y agoBut some languages make it easier to write bad code than others.
- TheDong 6y ago> Having fewer keywords does make Go simpler to learn and simpler to read other peoples code Go carefully touts how few reserved keywords it has, but I think it would actually be a simpler to reason about language if it had more reserved keywords. For example, you may notice that "true", "false", "len", "new", etc all aren't reserved keywords. This sometimes does lead to bugs, for example someone may make a function, like "func memoize(new func(...interface{}) interface{}) func(...interface{}) interface{}", which shadows a common builtin function with a function argument. Usually, the above leads to a compiler error when you try to use the "copy" argument (a value) as a function, but every once in a while, you end up with a type-compatible shadow, at which point things can really break. It would be less confusing if things like "new", "len", "copy", and "true" were keywords, rather than builtins that someone may accidentally alias and shadow. If you account for things like rather essential builtins as well, go's list of keywords starts to look far less impressive, and on-par with java or C#.
- gher-shyu3i 6y agotrue := false is valid golang code
- makapuf 6y agoIndeed https://play.golang.org/p/-HvoqUjiE6s https://play.golang.org/p/-HvoqUjiE6s
- DangitBobby 6y agoWow, WTF? Why are true/false not reserved?
- oblio 6y agoThey were worried about internationalization and they though reserving vrai/faux, adevărat/fals, etc would be overkill. I'm kidding. It does seem like a strange decision...
- colejohnson66 6y ago
- onislandtime 6y agoTo me, compared to other languages, I find Go easier for expressing my ideas in code. People seem to argue as if there was an objective truth. Different people may have different learning styles and working requirements. I'm not programming full-time so I prefer a simpler language so I don't forget. A full-time programmer may want to invest in a more "complex" language. See, you are all right.