5 ms·
the key is simplicity, you're complaining about language features that allow you to write "fun" code, but remember that we spend around 80% of the time reading
by yandrypozo 6y ago
the key is simplicity, you're complaining about language features that allow you to write "fun" code, but remember that we spend around 80% of the time reading or debugging code, the main focus of Go is about writing code that's easy to read which will allow you to scale a project or source code with more people, also remember that easy doesn't mean simple, I think these 2 talks will make you understand my idea a little bit better:
https://www.youtube.com/watch?v=rFejpH_tAHM https://www.youtube.com/watch?v=rFejpH_tAHM
https://www.youtube.com/watch?v=2y0pmRJNkLA https://www.youtube.com/watch?v=2y0pmRJNkLA
- kevinmgranger 6y agomap/filter and sum types are not about "fun", they're about correctness and expressiveness. map/filter and their equivalent loops are both perfectly readable, but the latter involves more boilerplate.
- hrez 6y agoI'd settle for comprehensions. It already has generic for/range so why not. That would cover a lot of boilerplate annoyances.
- somethingwitty1 6y agoAnd I'd disagree. Numerous engineers of differing skill levels (what I deal with day to day), struggle significantly when map/filter are added into the mix. And we may say "get better engineers", but we don't have that ability. We have to write code that is maintainable for the engineers we have and can get (and the ones coming in the future).
- Guthur 6y agoCome on, map and filter difficult? That's hyperbole of the highest order.
- ecnahc515 6y agoNot really. They require a basic understanding of higher order functions and often heavily use closures. Those moderately advanced concepts. It’s also sometimes harder to write efficiently to avoid multiple iterations over the same collection. I think many many people are way more comfortable with loops than people are with map/filter.
- the_af 6y ago> the key is simplicity Simplicity (in language features) can lead to complexity (in code) that is hard to maintain.
- piazz 6y agoCorrectness isn't about fun, although fun is definitely a side effect. I agree Go is easier to read if you're primarily familiar with C style imperative programming, but once you've strayed from that a bit, a PR in Typescript is no more difficult to review than one in Go. The big benefit of languages with more expressive type systems is the confidence you get that your code will work as expected if it compiles - I felt this in Swift more than in TS, and very little in Go.
- nvarsj 6y agoI love go but the OP is completely right. Lack of basic collection functions is incredibly aggravating and slows down productivity substantially. At least it's not as bad as Java.
- DaiPlusPlus 6y agoJava's photocopy of .NET's Linq in the form of "Streams" is usable.
- vips7L 6y agoI'm not sure how you can have that opinion of Java when Go is basically Java pre-generics. Especially in the context of collection functions. Java's stream API is simply amazing.
- nvarsj 6y agoYeah sorry, the Java collections API is pretty great. I meant in terms of raw boilerplate the language requires you to type to get anything done. This is definitely improving, and you can use things like Project Lombok to generate a lot of it.