31 ms·
The Value in Go’s Simplicity
- capableweb 7y agoPeople who likes Go's simplicity, have you ever looked into the even simpler syntax of lisps? For example, Clojure have minimal amount of syntax, that once you know, you know the entire language. The rest is just libraries that you use, the actual program/data structures or language modifications (macros) that each codebase usually employs a bit different depending on needs. But lisp languages are really, really simple, even more simple than Golang (or any C like language) can be. Take a look at this (short) page which describes ALL the syntax of Clojure (except macros) if you're interested: https://clojure.org/guides/learn/syntax https://clojure.org/guides/learn/syntax
- pixelmonkey 7y agoAs a long-time Clojure user, I find the claims that many Clojurists put forth that Clojure “has a minimal amount of syntax” to be quite misleading, especially toward beginners. I think Clojure has a lot of syntax. The syntax is just embedded in a number of conventions, macro mini-languages, and the reader syntax itself. Because Clojure’s syntax can be extended in user space (via macros and related tooling), the syntax also grows more rapidly than other communities. As a professional programmer who came from Python, Java, C, and JavaScript, I found a lot about Clojure compelling, but “minimal syntax” was not one of the compelling points. To the contrary, I think there is a lot more to learn in Clojure than other languages about how to properly structure your code. As I wrote in my blog post comparing Python and Clojure: > ... the Python programmer will observe that in the Clojure program, many aspects of the program are implied, rather than annotated by special syntax. Many Clojure proponents will say that Clojure has a “simple syntax”, but I think this is misleading. They don’t mean simple as in “easy to read without prior context”. They mean simple as in “unceremonious”. Perhaps they mean simple as a contrast to “baroque” (how you might describe Java or C++’s syntax). Clojure does have a syntax, but it is implicit from the layout of the code in the list data structures. http://amontalenti.com/2014/11/02/clojonic http://amontalenti.com/2014/11/02/clojonic
- millstone 7y agoAgreed - a concrete example is the threading macros: (defn calculate* [] (->> (range 10) (filter odd? ,,,) (map #(* % %) ,,,) (reduce + ,,,))) This is nominally a library as it can be implemented via the language primitives. But in practice this occupies the same space as Haskell's do-notation, and the learner cannot ignore it. The lack of special syntax becomes an implementation detail.
- robert_tweed 7y agoAn important difference is that Go not only has a concise set of constructs, it also tends to deliberately avoid abstraction. So any given piece of code is very explicit and self-contained. Apart from function calls, you can tell exactly what it does without looking up anything else, like a macro definition for example. It similarly doesn't have a lot of different ways to do the same thing tends to be opinionated about idioms (gofmt, for example). Something like a Lisp DSL would be antithetical to the Go model of what simplicity means.
- ken 7y ago> Apart from function calls, you can tell exactly what it does without looking up anything else, like a macro definition for example. It sounds like you’re splitting hairs here. In my experience, macros aren’t any more mysterious than functions. The only difference, after all, is when they’re evaluated.
- balfirevic 7y agoThe other crucial difference is how their arguments (and result) are evaluated.
- silasdavis 7y agoThe difference is that they generate code. So now you have compile some code in your head as well as running your hypothetical execution. Nothing wrong with that but they tend to be harder to understand than functions.
- pjmlp 7y agoYep. Copy-paste for the win. Maybe they should do away with the abstraction that memory is endless.
- _ph_ 7y agoGo does not avoid abstraction, only certain constructs. You do have functional abstraction with high order functions. You do have types and methods.
- edflsafoiewq 7y agoThe simplicity of Go isn't in a syntactic minimalism. It's in the self-conscious restraining of abstractive power (eg. the article's example of the only generic data structures being slices and maps).
- jerf 7y agoLisp is simpler on a completely different dimension. Lisp code can be arbitrarily complicated to read due to arbitrarily complicated macros. This is frequently blamed for Lisp's continuing failure to take off, that every major program written in it is eventually actually written in a custom dialect of Lisp. This directly opposes, for better or worse, the sorry of simplicity Go has. (I think there's a place for both, so I'm not judging one as "better" here.)
- catalogia 7y agoAvoiding Lisp because macros could be abused is like avoiding C because functions could be abused. What if I create a function called "log_error" that actually tries to reformat your hard drive? There is nothing in C that requires me to give functions names that aren't nonsensical. Macros, like nearly anything else, are an abstraction that requires a little bit of restraint and common sense when you're using them. The answer to the "functions can have misleading names and therefore can be used to create intractable tangles of incomprehensible code" is "well then don't fucking do that", which is the same answer to the majority of problems people think macros cause.
- kazinator 7y ago> Lisp code can be arbitrarily complicated to read due to arbitrarily complicated macros. Lisp code can be arbitrarily simpler to read due to nice macros. > This is frequently blamed for Lisp's continuing failure to take off. This is largely a meme spread by people who have never developed in Lisp. The relative lack of popularity is discussed in Lisp communities, but that particular hypothesis isn't taken seriously, if it comes up at all.
- bpfrh 7y agoNot looked into it, but the simplicity of Go doesn't only come from its syntax. It also comes from the standard libraries which cuts down on libraries you have to use. For most of the stuff I do with Go I don't need extra libraries and when I use them, there are no suprises which mean I can easily check what they do. Compare that to JS or even Python, where I have to either use libraries for even the most basic stuff or have a huge amount of syntax and keywords.
- grenoire 7y agoThis is something that people overlook quite often. It is very important to have a well-documented, up-to-date, and capable standard library packaged with your language. It just creates a smoother experience altogether. Besides that, it also sets the standard for the 'right' way of designing your interfaces and whatnot. In Go, the third-party libraries are often compatible with the standard library methods and interfaces, which is just fantastic in both mobility between libraries, and having consistency with different projects.
- blondin 7y ago> Compare that to JS or even Python, where I have to either use libraries for even the most basic stuff or have a huge amount of syntax and keywords. in python, you don't have to. same for javascript, before the whole jquery era, and the nodejs era that followed, we didn't even know what javascript libraries were.
- JohnStrangeII 7y agoYes, I've been programming in Lisp and Racket for the past twenty years and recently switched to Go. The main reason was the availability of a large number of packages and the general tooling for Go. So far, I'm quite happy with my choice. Productivity is slightly less than with Racket, but outweighed by the small size of the executables, easier deployment, and more 3rd party libraries. Of course, I'm missing a lot of features that pretty much any Lisp offers, but the simplicity and static typing does overall have many advantages. Since you mention Clojure: That's useless for me, because it runs on the JVM. One reason to use Go is exactly that it produces static, self-contained executables that don't require any heavy infrastructure.
- pmoriarty 7y agoFor small executables, check out Chicken Scheme. For static typing, see Typed Racket (though Chicken Scheme is also moving in the direction of gradual typing, if I recall correctly).
- bb1234 7y agoIf you care about a rich standard library, and static self-contained executables, I would strongly suggest Crystal. I have used both Go and Crystal, and the latter is much more productive as well as simpler. It’s standard library is richer. See, for example, the things you can do with strings with the provided functions. I used to love Go. But after some time the verbosity got tiring. I moved to Crystal, and there is nothing I miss from Go. Two big caveats: 1. I dont work in a big team. 2. My main use case is a web-backend.
- zozbot234 7y agoFORTH syntax is even simpler than any lisp.
- makapuf 7y agoSo is BF... that does not mean it not complex to use.
- _ph_ 7y agoI am both using Go and Lisp and like both very much. As mentioned by others, the simplicity of Go isn't in the syntax, it is the conceptual simplicity. To large extend it does share this with Lisp. Especially if you look at scheme, most abstractions are built on top of functions, something you can equally do in Go, as you have first class functions and closures.
- orbifold 7y agoI‘be looked into clojure briefly. What made it unattractive to me was the lack of performance and complexity of the build tooling. Simplicity in go goes beyond the language itself. It is also very simple to build, depend on libraries and deploy.
- silasdavis 7y agoGo has had an absolutely appalling dependency management complexity for a long time. Go modules looks like it is going to fix that but it's long time coming.
- fortran77 7y agoSimple syntax is why I prefer Erlang to Elixir. The syntax is so simple you can learn it in one day easily -- a big plus when you have to work in multiple languages at the same time for one project.
- blondin 7y agoi agree with you. go is not the simple language its creators wanted. and i feel like it's only going to get more complex from here on. for example, i couldn't get a library to work the other day because of one of the dependencies needed a specific version of another library but "go get" (1.13.4) was getting utterly confused. i never looked into the modules thing and i found that there is a 4 parts series of articles on the official blog explaining modules are and why we need it. i just gave up at that point and decided to manually copy the version i wanted to the $GOHOME/src folder and it got me going...
- masklinn 7y agoPeople who like "Go's simplicity" are talking about a completely different kind of simplicity than Lisp's or Forth's or Smalltalk's. The latter are simple in that they're built around a few core concepts which are available to the developer, almost any tool the language designer had is available to the end user. They're simple in the sense that old school legos or meccanos are simple. Go is simple in the sense of simplistic, it provides a much larger number of restrictive features and most definitely doesn't give end-developers access to the language designer's tooling. It's the simplicity of playmobil or duplo: the developer is provided with much more concrete (and effective in a way) but much less flexible "primitives". And this is no secret, there's a pretty famous quote from Rob Pike explaining the design and purpose of Go: > our programmers are Googlers, they’re not researchers. They’re typically, fairly young, fresh out of school, probably learned Java, maybe learned C or C++, probably learned Python. They’re not capable of understanding a brilliant language but we want to use them to build good software. So, the language that we give them has to be easy for them to understand and easy to adopt. Making codebases look uniform and preventing building abstractions (by the language being actively hostile to abstractions which are not built-in) is in line with that.
- tfha 7y agoWhat is with all of the condescension that other developers have towards Go developers? Go has a set of highly desirable features that are very practical for building large team projects. Imo it's unnecessarily hostile to compare go to playmobile and diplo, and it really encourages people to overlook the genuinely excellent features that go supports.
- hu3 7y agoThere's unreasonable hostility towards Go because it is eating the lunch of some folks' favorite languages. It's not rare to see people feel offended by others being productive with Go and liking it.
- zozbot234 7y ago> some folks' favorite languages Java/.NET, Python and Ruby? I say bring it on.
- LessDmesg 7y agoThe simplicity of not having generics? Plus a broken type system (interface{} everywhere). That's not simplicity, that's just sloppy bad design. Look into Zig for a much better language in the same niche.
- petilon 7y agoI wish developers of TypeScript would learn from Go. TypeScript is awesome, but it is getting larger and larger and larger with every release. Soon it will become like the US tax code, and no one person will know the entire language.
- sek 7y agoI think the situation with TypeScript is a little different. JavaScript is a very powerful language and you can do a lot of "hacky" things with it. It feels to me like most new features are an improvement, I use :any very rarely now and can model almost everything with it. I you would design TypeScript from scratch, you might have a point.
- erokar 7y agoNo wonder, since the man behind Typescript, Anders Hejlsberg, is also the man behind C#. The goal seems to be to include as much as possible and constantly evolve the language. Some people appreciate that, others not so much.
- thomasz 7y agoTypescript utilizes black magic to help building large systems based on the shaky foundations of javascripts type system. C# is very conservative in comparison. It only adds concepts that have been implemented by (often times several) other languages before, and are therefore well understood.
- frou_dh 7y agoThe armchair psychologist in me considers there to be two camps of programmer in this regard. One that gets distressed by something like not having the entire language in their head, and the other that doesn't ponder that kind of quandary in the first place.
- deleted 7y ago[deleted]
- 7y ago
- erokar 7y agoWhile there is certainly something to be said for simplicity in a language, I think Go is too extreme in this regard. What it gains in simplicity it looses in expressiveness. This leads to more lines of code per feature, and bugs in software has been shown to be a function of LoCs [1,2,3]. One example of Go's lack of expressiveness is that loops are not abstracted away, e.g. you can't use higher level constructs like map and filter on collections. There are other languages that IMO strikes a better balance between simplicity and expressiveness, like Python and Elixir. 1. https://ieeexplore.ieee.org/document/1702967 https://ieeexplore.ieee.org/document/1702967 2. https://link.springer.com/chapter/10.1007/978-1-4471-3003-1_3 https://link.springer.com/chapter/10.1007/978-1-4471-3003-1_... 3. https://www.amazon.com/gp/product/0735619670/ https://www.amazon.com/gp/product/0735619670/ (Chapter "Developer Testing")
- vhakulinen 7y ago> What it gains in simplicity it looses in expressiveness. This leads to more lines of code per feature, and bugs in software has been shown to be a function of LoCs If the lack of expressiveness equals to greater amount of code and thus more bugs (in Go), does the same apply for languages that are more verbose (say, Java)? And if language is more expressive and less verbose (say, Python or Javascript maybe?), does it mean less bugs?
- fluffything 7y agoThe OPs claim that it has been shown that bugs are a function of LoCs is unsubstantiated at best. The number of bugs in a program correlates with the number of LoCs, but that's about it (correlation does not imply causation). The claim is also quite absurd, since, for example, you can pre-process any C or C++ program ever written into a single line of code, yet this operation doesn't reduce the number of bugs in these programs, therefore the amount of bugs is not "just" a function of the amount of LoC. Languages with better abstraction capabilities than Go (e.g. Rust or Python), might require programmers to type less, but the resulting lines of code are often dense. For example, I'm quite comfortable with Rust iterators and Python lists comprehensions, but it still takes me much longer to parse what code using these abstraction does, than code that just uses a simple for loop. It definitely feels great to cram a 10 LoC loop into a 1 LoC list comprehension in python, but reading that code 6 months later never felt that great, even for code that I've written myself. I just need to stop at those lines for much longer.
- deleted 7y ago[deleted]
- lacker 7y agoI’ve been working in a Node codebase for a bit, and I am really missing Go’s built-in profiler and benchmarking support. It’s pretty well integrated into the default tooling, and easy to use.
- XCSme 7y agoWhat about using the Chrome Dev Tools for Node profiling?
- lacker 7y agoThe node tools & chrome dev tools just seem very poorly integrated by comparison with the go tools. In go, if you have a unit test and you want to profile the code in it, it's just a few code changes to set that up. To use the chrome dev tools, you have to connect to some running process with a browser, which requires at least rearchitecting whatever you're doing so that it's an indefinitely running process. The built-in node profiling is sort of medium in ease of use, but low quality in the information it returns. Often it's hard to figure out what high-level function calls correlate with the low-level performance info.
- pjmlp 7y agoExpecting mass exodus from Go developer to Oberon-07 as the language starts adopting more features. The "simplicity" is shown in the amount of code generator frameworks.
- FpUser 7y agoWhy bother if there are already well developed relatives Delphi/FreePascal with nice tooling and plethora of libraries.
- musicale 7y agoI like Oberon, both the language and the system, but I don't see either expanding beyond niche usage, in spite of their elegance and compactness.
- pjmlp 7y agoI was being sarcastic, as Wirth is probably the only language designer that removes features with each language revision. While I loved my experience as Oberon user/dev, and it opened my mind to systems programming using GC languages, my favourite languages on Wirth's linage aren't done by him, rather influenced by his creations. Modula-3 (which comes from Mesa/Cedar, not Oberon), Active Oberon (another ETHZ team), Zonnon, Delphi.
- pcr910303 7y agoOk, I understand that people that use Go has a different idea about it, but... > Code duplication is more acceptable in the Go community than elsewhere. > Many times, you’ll need to write that functionality yourself, or copy/paste it from a StackOverflow answer. Am I the only person that this is regression? How can code-duplication be defended by 'simplicity'? > Fewer dependencies means fewer things that break while you let a project sit idle for a couple months. I thought that pinning dependencies is \the\ solution for this? I don't use Go, so I'm not sure about the Go packaging story, but is there no package pinning solution? Yarn & npm handles this beautifully...
- xwdv 7y agoCode duplication reduces coupling between multiple unrelated pieces of code. Edit: not sure why the downvotes, perhaps these people have never seen a junior engineer go on a fanatical deduplication spree across a whole project, or perhaps these are the junior engineers.
- YesThatTom2 7y agoA little code duplication prevents mounds of dependencies. I’ve seen people link to multi-megabyte modules to save one line of duplicated code. At Google this was a disease. Good to see they’re fixing it.
- manaskarekar 7y agoSurely there is a middle ground.
- xwdv 7y agoYes, the middle ground is to avoid duplication when code is non-trivial. Most code is trivial.
- fauigerzigerk 7y ago
- YesThatTom2 7y agoGo’s simplicity means I have to focus most of my time on solving the problem instead of showing off that I know (insert inscrutable feature) and figuring out what the last person to touch the code when they used (other inscrutable feature). That sucks! Why sh I kid I help the company solve their business problem when I could be spending all afternoon debugging (insert language issue)
- AzzieElbab 7y agoI do not find go simple. Too many hidden conventions that my brain refuses to memorize because I do not see any logic behind them
- kristianpaul 7y agoI would love to use Go just if it wasn’t for the garbage collector
- bsaul 7y agoGo is compiled to assembly. What makes you think it's an interpreted language ?
- kristianpaul 7y agoGarbage collection
- saagarjha 7y agoThey’re not related.
- hu3 7y agoGo is compiled. The compiler is so fast that for most programs it looks like it's interpretting the code: go run main.go --------- OP edited in "garbage collector" over "interpreted".
- musicale 7y agoBut the garbage collector only pauses for 100 microseconds... until the next memory operation, when it pauses again. ;-/ More seriously, as of last year at least mark phase pauses could be significant, on the order of seconds for large heaps.
- ausjke 7y agoDoes golang have an option to use 'shared' libraries/modules? while it is great its size is unfit for so many embedded devices, tinygo is a good try, but still.
- takeda 7y agoAs far as I know it doesn't. One of the selling point is that everything is a single executable.
- suresh70 7y agoI'm new to Golang and have been exploring it for a while. Go isn't simple to me when it comes to web dev. It starts with the scarcity of resources to learn from. I'm looking for how to structure the codebase(boilerplates, best practices etc), how to go about unit and integration testing, dependency and configuration management. Are there any resources somebody here can point to regarding these topics?.
- christiansakai 7y agoCheckout some examples of Clean Architecture in Go.
- dhconnelly 7y agohttps://www.usegolang.com https://www.usegolang.com from Jon Calhoun, who is well-known in the community, could be useful
- dunkelheit 7y agoOne benefit of radical go-style simplicity that I haven't seen discussed much is that it forces you to focus on the task at hand. Like, you know that your code will look like shit anyway so it is pointless to fuss too much over it. Whereas many programmers using a more "clever" language like haskell will spend a lot of time trying to make code more readable, searching for the right abstraction, arguing whether something is a monad or some other gizmo. Most of it is wasted intellectual effort. Everything in moderation of course. For me personally simplicity of go is too much and I don't feel comfortable writing it.
- RHSeeger 7y ago> Most of it is wasted intellectual effort. I would challenge this. I would say _some_ of it is wasted, but most of it works towards making the code more understandable. And code being understandable to the next person to read it (both in the small "what is this block doing" sense and in the larger "what is this algorithm doing" sense) is very important.
- sidlls 7y agoI can't speak for the GP, but my interpretation is that the wasted effort comes from doing what you describe when, instead, one could have chosen a simpler language and produced understandable (albeit "ugly", "not eloquent") code the first time round. Then one can turn those intellectual wheels on a more interesting problem to solve.
- chc 7y agoThe assumption that simplicity in a language naturally encourages understandable programs is a mistake IMO. Language complexity generally exists because the language is trying to shoulder some of the complexity that would otherwise go into your program. For example, Brainfuck is nearly the simplest language possible — you could write a full rundown of its features on a sticky note — but programs written in it are not very readable. Even Go did this by adding async features into the core language. This is a complication that doesn't exist in the older languages it was intended to build on, but by building that complexity into the language, they reduced the burden of using it in your code.
- oefrha 7y ago> Just Enough Batteries Included This is just an anecdote, but recently I decided to give golang a spin, and wrote a small command line utility in it. I won’t tell you the pain of trying to find an argument parser with support for GNU-style long options. I suppose that’s something I should write myself rather than use the standard library or find a third party library, because simplicity. /s Edit: folks posted helpful suggestions, I take this paragraph back. Instead, let’s talk about something basic, regexp. Turns out golang’s regexp package supports named capture groups, but if you want to actually refer to the capture groups by names, you need to manually pair FindStringSubmatch result with SubexpNames in a loop. Can’t make this shit up. Seriously, what’s the point of named capture groups if you can’t refer to the groups by names? If this is just enough battery included, your expectations might be a tad too low.
- dev_dull 7y agoFor CLI it’s true to the Go mantra. If the flags library is “good enough” why not just use it and avoid being fancy? Besides, isn’t it feasible someone might confuse long and short options? “Is -d and —delete the same, or is -d —debug??” KISS even if it’s annoying. As for loops, I know that they’re generally more common in Go. Another example is finding if an element exists in a slice. Most of the implementations is this stuff is just a loop under the hood in the end. From a Java background it was strange to me because I’m used to dealing with classes and there’s always a method for this or that...
- oefrha 7y ago> For CLI it’s true to the Go mantra. If the flags library is “good enough” why not just use it and avoid being fancy? Users of a command line utility ultimately don’t care what language it’s written in; having a familiar interface is a much more important goal. Since the vast majority of Linux utilities these days use GNU-style rather than Unix-style long options, it stands to reason that the latter is a better choice for users. (There are also technical advantages I won’t get into.) I know Rob Pike probably isn’t a fan given his background, but why not give developers the choice to build what they want to build, instead of shoehorning them into something they dislike? What’s the point of being opinionated here? (Edit: Sorry, didn’t mean to imply that the standard library ought to have it; however, I do find it strange that in the ten years of golang the community didn’t bother to come up with a reasonably good library for it.) Btw, flags is very primitive and can hardly handle anything complex, even if you accept the Unix-style.
- pmoriarty 7y agoIs Go simple? It looks positively complex compared to Scheme.
- 13415 7y agoI have a direct comparison, since I've been programming substantial amounts of code in both languages. I'd say that Go is much simpler in practice. Think about all those classical functional LISP exercises to recursively manipulate lists such as reverse a list, return the nth element, flatten lists, combine lists in various ways, and so on. I doubt you can write good Scheme code without having done those exercises at least once in your life. And at least for complete beginners these exercises are not easy. There is no equivalent to this in the Go world. Of course, you could do it, you can do functional programming in any language. It's just not usual. Paradigmatic Go code is simple, imperative style with a lot of mutation. You only need to learn how structures and interfaces work and your good to go.
- pmoriarty 7y ago"Think about all those classical functional LISP exercises to recursively manipulate lists such as reverse a list, return the nth element, flatten lists, combine lists in various ways, and so on. I doubt you can write good Scheme code without having done those exercises at least once in your life. And at least for complete beginners these exercises are not easy." In practice, you'd just use a library function for pretty much all of those. Nobody writes those from scratch in Lisp or Scheme except as an exercise. Also, once you do get the hang of it, recursion is a much simpler and more natural way of expressing many algorithms. But it too is not necessary in Lisp or Scheme, and you're welcome to write the iterative equivalent, if that's what floats your boat. As for writing in an imperative vs functional style, I personally find the latter simpler and more reliable. But nobody forces you to write in a functional style in Lisp or Scheme. They're both multi-paradigm languages, and you can write in an imperative style in either, if you prefer.
- matthewmacleod 7y agoOkay, so there's definitely simplicity. I agree that this is in many ways a nice change from some of the more popular languages, which can get a bit complex and heavy, with a focus on features that are nice in isolation but add up to a surprisingly difficult architecture to comprehend at the global level. I just don't think Go gets the balance right. There are some parts of the language that are such a joy to use – C interop is simple and elegant, the concurrency story is great, the standard library is great, and in contrast to some other people, I think the error handling is also a nice example of simple and effective design. The wider tooling system is decently usable (with the exception of gofmt, as mentioned in the article, which I think is the single best tool I've ever used in any language). But "simplicity" in Go-land seems sometimes to be the enemy of expressiveness. The lack of abstractions over operations like filtering, mapping, or removing items from a collection is incredibly irritating for such a common operation – instead of immediately obvious actions, there are tedious manual loops where I end up having to read like 10 lines of code to figure out "oh this just removes something from a list". The use of zero values is a crime against nature. The type system is shameful in practice compared to other modern languages, with so much code just being "just slap an interface{} in there and we can all pretend this isn't a disaster waiting to happen". It feels like such a lost opportunity to exploit a richer type system to eliminate whole classes of common errors (which are predictably the ones I keep making in Go code.) I guess it's frustrating that a language—which is relatively well-designed and intended to be simple—too often makes things more complicated overall by making fallible humans do things that computers are better and more reliable at. I'll keep using it, because it fills a really nice niche that no other language is quite suitable for. But I'll keep being a bit annoyed about it, too.
- why-el 7y agoI agree with you on most points, and they are working hard to fix the generics issue in a way that does not make you lose all the nice things you mentioned. The only part I didn't get is: > The use of zero values is a crime against nature Can you elaborate?
- crimsonalucard 7y agoGenerics is only part of the issue. Go has a crippled type system. Json in go cannot be represented as a type and also is not type safe. This is 100 percent because go is missing a basic type primitive. Json contrary to what many people think is not untyped. Json is represented by a recursive sum type which go has no ability to represent. I think what caused this issue is more because the designers of go are more systems people rather than language theorists.
- enraged_camel 7y agoMy first car was a 2002 Honda Civic, bottom of the line. Aside from automatic transmission, everything - doors, locks, and so on - was manual. It didn't have a CD player or even A/C. You might say it was a simple car. At first I loved its simplicity. It did its basic function (getting me from one place to another) quite well. I drove it only occasionally, as I was in college, and it didn't fail me in any way. Then I graduated and got a job, and started commuting. Once I found myself driving that car every single day, I started to resent its simplicity. In a few occasions it bit me in the ass - one time, my passenger forgot to lock their door after getting out, and overnight someone got in and rummaged through the car and stole a bunch of stuff. That would not have happened if it had automatic locks! That's how I feel about Go: if you're writing simple microservices occasionally, then it's a good language. But as usage becomes more frequent and serious, the simplicity starts to seriously hold one back. I understand the reasons behind that simplicity, but, as with all things, too much of a good thing can in fact be bad.
- b0rsuk 7y agoIn Go's case, it's too early to tell how it scales. It has the opposite approach to readability as Perl. I wonder if Go ends up sharing Perl's fate. Two languages that make people feel very productive, but don't seem to scale very well.
- rollcat 7y agoDefine "scale"... Large codebases? Teams? Long-lived projects? So far Go looks excellent at all of these
- mrmonkeyman 7y agoGo is what (CRUD) programming should be. Boring, dumb and safe. All my Go code is exceedingly boring, lots of plumbing, lots of dumb stuff. It is easy to write too, so I get done quickly. Then again, it's rock solid and performance is off the charts (compared to abominations like RoR or django). It makes me feel like a plumber and I hate that, but it's better to acknowledge reality than fight it: 90% of programmers are fancy plumbers and that is OK. The worlds needs plumbers.
- bfrog 7y agoGo is so simple that there are dozens of code generators and project dependency management solutions. Yet people live to espouse it's simplicity. It's simple like C in that regard, you have to roll your own solutions to avoid copy pasta hell if you want type safety and sane project management. The real mistake though is the lack of an Option type. The inability to express optional differently from passing references efficiently is a large test case burden.
- hu3 7y agoBased on what you wrote I can't help but think you haven't used Go extensively or at all. Code generators are rarely used and Go has an official built-in dependency management tool: go modules. https://blog.golang.org/using-go-modules https://blog.golang.org/using-go-modules
- bfrog 7y agoI wrote 100kloc rest service using go, so actually I do know a thing or two. Granted this was 4 or 5 years ago so perhaps things have improved.
- floatboth 7y agohttps://twitter.com/vertexclique/status/1194902103929569280 https://twitter.com/vertexclique/status/1194902103929569280
- sosodev 7y agoMy feelings on Go are pretty mixed. I think a significant portion of software can be described inside the box that you’re given with Go but if you enter even moderately complicated territory it becomes a shit show. I’ve had the displeasure of working on a pretty complicated Go project at work and it’s given me plenty of counters to what OP is saying. First, Go’s dependency management has been terrible and inconsistent for years. Dependencies started very loose and without any versioning at all and I was bitten many times by this mostly because developers used the looseness of Go get to consume repositories that were never meant to be public APIs and without versioning those repositories had zero guarantees of compatibility. The community eventually noticed this was a problem and vendoring was introduced but the community and Go itself flip flopped on a “correct” solution for ages which ultimately led to even more package incompatibility. Now we’ve got modules which is a step in the right direction but it’s going to take quite some time for all of the Go projects to implement it correctly. Modules have been nothing but a pain in the arse for us because our Go project has a lot of dependencies. Another thing I hate is the idea that people spread that Go’s simplicity leads all developers to write simple, clean code. Some developers, I’ve noticed, pine for abstraction like moths towards a lightbulb. In Go abstraction can be very painful to do elegantly and I’ve seen some nightmares where developers have tried. Using reflection on interfaces produces some of the shittiest code I’ve seen in a long time and yet I’ve seen it repeatedly by different developers in different organizations. I must not be the only one who has noticed these issues because the creator of Go himself made the Go Proverbs (https://go-proverbs.github.io/ https://go-proverbs.github.io/) which include things like “interface is never clear” and “reflection is never clear”. Okay, I’m going to stop ranting now but I seriously don’t get the hard-on for Go. I think I kinda got it before I used it professionally.
- bob1029 7y agoThis is exactly the take I have been expecting to unfold for a lot of developers regarding Go. It is a very compelling language to get started with because it is so reductionist compared to alternatives like Java and C#. This makes learning it very straightforward, to the extent that you would almost want to die defending the language that is feeding your dopamine loop. But, one day you might wake up and realize it was all a fantasy. That is, if you ever step foot into a shop where you are expected to build a line-of-business application with sufficiently-complex business entities and rules. All of your ideas about how wonderful Go is will fly directly out the window. Sure, you can eventually implement anything in Go. It is Turing complete after all. But, that isn't to say you'll have enough time to implement it. Go advocates will happily dismiss the value of things like LINQ, generics & reflection until they are faced with a reality where tools like these are the most productive way get a feature into production before 2020 hits. If you open your mind up to the possibility of using different (god forbid, unique) approaches to solve problems, you might then find that Go does not even offer the best implementation of these alternative language features.
- deleted 7y ago[deleted]
- ausjke 7y agoC is popular also partially due to its simplicity by design. Javascript fatigue is caused by its 'complexity(imperfectness)' in design, but it took a good spot by accident however bad it was designed.
- tetha 7y agoAfter some work with go, I wouldn't call it simplicity that much. Simplicity has too many implications and expectations and by now, I'd call simplicity context dependent. In the right context, spring boot can simplify backend code, in the right context, libraries like panda can simplify data crunching algorithms in python. And even as this thread shows, "simplicity" immediately blows up into discussions between the different kinds of simplicity. I rather tend to call what go does regularity and the language design of go does promote said regularity. Regularity in this context means: Go codebases and lots of go code tends to follow very similar patterns. And this in turn makes it simple to digest even complex code bases, at least to me. A go codebase might just contain more code, but chasing some listener on the result of another listener through multiple annotations and config files in a java codebase... yeh. And on top of that, this kind of regularity, as well as the kinda small set of libraries to do something makes it easier to get started with the language in my experience, especially for people who aren't seasoned developers.
- FpUser 7y agoWithout digging too much into syntax, issue of GC there is a simple ani-feature in go: I can not create and control native threads. While Goroutines are nice and needed feature some of my software simply can not function without the native threads. Hence Go is no go for me.
- api 7y agoWhen I write in Go I spend almost all my energy thinking about the thing I am writing, not the language. It's a breath of fresh air, like modern C with a safety lock on the footgun. I learned how to code "thin" low abstraction C++ and un-clever dynamic code in languages like Ruby and JS as I matured as a programmer, but it takes discipline. When I was younger I fell like so many others into the trap of showing off my command of languages instead of showing off my command of algorithms and ability to solve problems elegantly. I don't find Go that ugly, especially with standard 'gofmt' formatting. It's so simple the brain learns to parse it as effortlessly as the compiler. The brilliance of a program is its results / its complexity, with the greatest code ever written being simultaneously the simplest and most impactful. Go makes that maturity natural and easy. I think it's a great influence on the programming zeitgeist as well as a nice language. Haven't tried Rust yet but my impression is that its somewhere between C++ and Go. Can anyone comment on Rust's cognitive load?
- steveklabnik 7y agoRust has an interesting relationship with cognitive load. At first, it is fairly high. But then, at some point, stuff just clicks and it drops dramatically. How long that takes depends on the person, they’re background, how much support they have, etc. As a random anecdote, we had a team at work who started a Rust project, and it took them a month or two to get going. Now they’re sailing quite smoothly. (We have other teams as well but I’m only really familiar with the process for one of them.) The reason for this is that you have to learn to work with the compiler and its rules. At first, that’s a struggle. But later, it’s just helpful, and you have to think about things way less because the compiler is helping you keep track of them. It’s like a pair programmer.
- tfha 7y agoHave you used a lot of go? I'm a big fan of rust and definitely like rust devs and the rust community, but I find that people haven't used go enough to "get" it don't really understand just how much it can take away from cognitive load. Rust and go are not really comparable in this regard, even if rust is much better than most people realize. There are too many ways to approach a problem in rust. That said, definitely there are plenty of places where rust is a much better language choice than go
- cygned 7y agoThe biggest pain point I have is the lack of nil-able vars. Maybe it doesn’t make sense in term of type systems, maybe it is that way for reasons of reliability - but in practice it’s a pain to work with JSON APIs or NULLable fields in DMBS’ if you come from a language where these things just work.
- erikpukinskis 7y agoI’m curious, has anyone here had an actual need for genetics in production code? I mean, like you actually have an uncountable or at least large number of types that you want to push through a generic mechanism? I use “generics” in TypeScript but it’s always a very small number of types: usually two, maybe up to 10... There’s no reason I couldn’t do that without generics, just by writing a couple line plugin for each type that converts it to a common representation. I’m not convinced that’s even strictly worse than generics from a usability perspective.
- snagglegaggle 7y agoYeah. The usual case is a container type or composing with a container type, but there are many "algebraic" types that you may wish to use if they could accept types to parametrize them over.
- vmchale 7y agoI wrote a blog post about an example that came up for me: http://blog.vmchale.com/article/ats-templates http://blog.vmchale.com/article/ats-templates
- agumonkey 7y agoThere's something about russ cox writings that exemplifies go 'cleanliness', they engineer stuff to make a task clearly, nicely and nothing more. People complain about the lack of generics but I wonder if they didn't allow it to avoid an abstraction explosion, at the cost of redudant/copypasting.
- andy_ppp 7y agoIf it so simple why are the developer ergonomics so bad, if err != nil is a mess (Elixir has a with clause that would be useful), everything points to github master and module management is still extremely basic. The error messages are absolutely atrocious compared with something like elm or even python or Typescript, the type safety is a lie fairly often and you can still write programs which crash due to that. Then there are go channels which are kind of cool until you realise they can very easily lead to race conditions and a version of the actor model would have been much better. I could go on but go is like a nicer C rather than a modern language people should be building web services in.
- chrisseaton 7y agoIsn’t the actor model just as racy as channels? Race conditions everywhere is one of the big downsides of actors compared to other concurrency models.
- andy_ppp 7y agoWithin any distributed system you can have races but in Golang the mutable nature of channels makes this almost impossible to reason about (in my experience most people use mutex’s in go unless doing something extremely simple).
- ryan_glass 7y agoThis article really, really makes me want to give Go a shot - more than anything I've read about the language before.
- takeda 7y agoYou should, you either will love it or hate it. I personally don't like it, but from your response it sounds like you might have a different opinion.
- dana321 7y agoSome great points about go: If you don't use it, remove it (compiler checks to see if a variable / module import is actually used) The real pleasure in go vs c/c++ is compiling / linking is easy with the new go modules support, multi-platform out of the box. Kinda like cargo in rust. Kinda. Downside is.. C/C++ modules are 2nd class citizens that can slow your whole code down.. Conversion is much better, but usually someone has done it yet.. sqlite needs a go port. I think of go as an advanced assembly language with some c-like idioms and a powerful runtime to handle processor thread scheduling.
- pstuart 7y agoUnfortunately no recent activity, but this comes to mind: https://github.com/elliotchance/c2go https://github.com/elliotchance/c2go
- Animats 7y agoI tend to agree. I was a big fan of Rust at first, but they put in too much stuff. Borrowing is brilliant. The semi-functional programming features, not so much. Go was created so Google people could write server-side stuff in something less brittle than C++. It's a good match for that. The library stability is a good thing. Those are libraries Google uses internally, so you know they're executing millions of transactions a second somewhere. The error cases have been encountered already.
- zozbot234 7y agoThe "semi-functional" programming features have always been a part of Rust - some of them have even been removed since, such as typestate. The borrow checker as we know it was actually added quite a bit afterwards.
- verdagon 7y agoFascinating! I thought Rust was built around the borrow checker. Did Rust ensure memory safety back then? Back then, was their goal to make a more modern C++ with functional influence maybe?
- Keats 7y ago> In my opinion, of recent languages, Go has the sanest versioning and dependency story. I haven’t had a single breakage due to an update in Go. I don't know about that. I've tried to build 3 Go applications in the last couple of years and none worked because some of their dependencies had breaking changes in master. Hoping that someone doesn't push a breaking change on master, doesn't change username or doesn't delete their repo doesn't seem very sane to me. At least vendoring is well supported.
- jeffrallen 7y agoGo is simple enough that your idiot co-workers can understand it. (Remember: They think the same about you, and they are right.)
- apatheticonion 7y agoIt's important to remember that Go isn't by itself enough to write quality software. Developers must arm themselves with established and tested software design patterns to utilize the language effectively. The same goes for other languages as well, however Go's emphasis on providing a tiny toolset amplifies the benefits/consequences. ... Also we need generics
- edgarvm 7y agoGo is not a simple language, it lacks of features.
- martincmartin 7y agoIn woodworking, the only tool you need is a hammer and chisel. With enough effort, you can make a decent table leg, you don't need a lathe. But if you do it several times, you think "if I just invest time into learning the lathe, I can save a lot more time when making table legs. In fact, I might be able to make a more complicated table, since the time and effort saved when making the legs can now be spent on other things."
- millstone 7y agoI don't know Go, but from my outsider's perspective it doesn't look simple! For example compare inserting into a list in Python: list.insert(index, obj) with apparently idiomatic Go: a = append(a[:i], append([]T{x}, a[i:]...)...) Or compare Python's `list.reverse()` to Go's recommendation: for i := len(a)/2-1; i >= 0; i-- { opp := len(a)-1-i a[i], a[opp] = a[opp], a[i] } This seems quite error prone. Idiomatic Go taken from https://github.com/golang/go/wiki/SliceTricks https://github.com/golang/go/wiki/SliceTricks
- andrenth 7y agoOne of the things to keep in mind with Go is that in general it doesn’t try to hide possibly costly operations under simple to use interface. So in your example, append may need to allocate, and the fact that it returns a new pointer makes that clear. For the second example, you could use sort.Reverse, but the loop makes the cost of the operation clear.
- xyzzy_plugh 7y agoAdditionally, at least in my experience, you don't ever want to just "reverse a list", you want to do something, like print it in a certain order. Writing the loops yourself makes it simpler to accomplish the task at hand, I find.
- CAMLORN 7y agoIn the insert case call the function InsertWithAllocqation, and also provide an Insert variant that doesn't allocate but can fail. In the reversing case, call the function ReverseInPlace, then require the user to make a copy either before or after. This gets you the same goal--not hiding the costly allocation--while also making it convenient to use and removing the possibility of mistakes. The real problem is that without generics, such functions actually have to be written in the same fashion as sorting where you provide a function for reading and writing both, as opposed to just working--so the "simple" loops which are indeed error prone actually become less code, and we all use them instead. I highly, highly doubt even the best Google programmer will always get the boundary condition on that reverse a list loop right especially in an emergency or at 3 AM, and this is a very simple case where Go just can't abstract on par with anything-with-generics. But my point is that you can meet the goal of not hiding operations just with good naming, if that's what you consider a terminal value of good pl design, and don't need to forego abstraction to do it.
- azth 7y agogolang is too simple. Real projects are complex, and having a simplistic (dumb) language just pushes complexity to the programmer instead of having it built in to the language and compiler. There is a balance to reach, and languages like Java do a much better job at this than golang.
- ryanmccullagh 7y agoI _hate_ Go’s encouragement and use of single letter variable names.
- deleted 7y ago[deleted]
- photon_lines 7y agoIf anyone is interested in learning Go, I made a relatively simple web-server with demo apps which you can find here: https://github.com/photonlines/Go-Web-Server https://github.com/photonlines/Go-Web-Server I don't agree with other people calling the language simple. It makes doing something like building a web-server from scratch very simple, but the actual language syntax and expressiveness is lacking in my opinion.
- vpmpaul 7y agoFollow up article in months.. Go's Simplicity is its weakness for XXX thing. I find these constant take one aspect of a language and paint the world with it to be unhelpful and distracting. However based on the comment section HN eats it up, no wonder people keep writing them. Its like Instagram for nerds I guess.