7 ms·
Ok this is going to sound ignorant, as my only experiences in backend services have been Go and Python. I don't like either. Is there something I'm missing? For
by thatswrong0 7y ago
Ok this is going to sound ignorant, as my only experiences in backend services have been Go and Python. I don't like either. Is there something I'm missing? For simple CRUD apps, both are sufficient. But (in my limited experience), the moment I've wanted to create more complex business logic with stricter constraints, neither has been quite up to the task.
Go doesn't make things easy. It asks you to repeat yourself. I don't like the lack of basic functions like a generic map / filter function.. I know Rob Pike just says "use for loops", but it feels so unnecessarily unexpressive. When I see map, I know what's going on almost immediately. For loops take more reading to understand. Nil pointers shouldn't be, yet still are, a thing (developers aren't perfect - why can't the type system help?). It feels like a straight downgrade from Python from a code clarity perspective. And it's typed, sure, but the type system doesn't let me express constraints that other languages allow me to do that would prevent entire classes of bugs. It doesn't feel worth it compared to Python. Yes, the core language ends up being comparatively "simple", but simple building blocks doesn't guarantee a simple overall system. And my company is very diligent from an architectural perspective.
But then when I look at Python, I'd rather just use Javascript with Lodash, esp. when it comes to the treatment of functions as first class objects[0]. Throw Typescript in there, and you get, in my opinion, a better type system than Go, so unless language performance is a major constraint (which it hasn't been for my company, our DB usage patterns it the biggest thing instead), why would I want to use either of these rather than Typescript?
[0] Edit: Dumb and wrong, I meant its treatment of anonymous functions. I don’t like lambdas.
- catalogia 7y agoGo seems to be optimized for onboarding new developers (particularly straight out of school) quickly, rather than for the long term comfort of developers using it. There are Rob Pike quotes that speak to the first part of that at least. If I was a business owner, I'd love Go. But what I can't really figure out is why so many devs love it. It's far from the worst thing in the world, I don't hate it, but I just can't get excited over it either.
- adtac 7y agoDefers, channels, inexpensive goroutines, a mostly consistent standard library, very good performance, garbage collection, being similar to C, strongly typed, and readability are the reasons why I've enjoyed writing Go exclusively for the past couple of years. Almost none of these is exclusive to Go, but the intersection of all these certainly is.
- wbl 7y agoYou might want to try Ocaml.
- dx87 7y agoFrom what I can tell by reading what Go developers write, they like it precisely because it's not something to get excited over. It seems like the kind of language where once you learn it, you don't have to keep up with a bunch of blog posts detailing all the cool new things being added to it, and decisions over stuff like formatting are made for you. I primarily use Rust for hobby projects, and the steady stream of new features/libraries can get tiring. You don't have to use the new stuff in your own code, but if you want to use popular libraries, you'll probably be stuck using the new features. Making everything async seems to be the new hotness, and sometimes I wish the language would be nothing to get excited over.
- stoicShell 7y ago100% agreed, and you made me realize something. As someone who writes — I mean prose, whether fiction or not (mostly not: essays, technical, etc) — I had to come to terms quite early with the dichotomy you explain here. There is a place for the "beautiful language", the parts of it and the ways of using it that make it a pleasure, as a writer and as a reader. This, unsurprisingly, usually demands a whole lot of additional work on top of the 'direct meaning'. Then there's a place, in casual communication, in business, in marketing, in essays as well, in technical docs, in speeches, in a lot of places, for the 'direct meaning', or close to that. The efficient use of language, when all form recedes in favor of meaning, of concepts, of getting that 'other' to get what you mean. It's just that, in human language, you do it all with the same tools, we use formal or topical subsets of a vastly larger ensemble. In programming, we're more likely to use different languages [themselves subsets of human language if you think about it, but let's forget that for the sake of simplicity]. And there are programmers among us who love to dabble in the form, like some writers would spend 10%, twice, ten times the effort crafting just "better form" over an already well-defined idea/story. While other programmers, or at other times, just focus on getting things done. Cue the spectrum in-between. So it all depends what we put in our code, as programmers, as human beings I guess. Is that thing a personal statement? Or is it just garbage code to temporarily expedite some roadblock? How do we approach complexity, bottom-up from the simplest elements/code, or top-down with the most expressive almost-meta entities? Maybe some side-line out-of-the-box angle? See how we'd word all of these, in human languages, as in code. We just wouldn't say the same, nor code (select languages) the same. I don't know if I explained it well. But looking at it from a human language writer, it all seems clear now. The whole rat race of languages, the churches, the sheer effort put into form when meaning has already been solved 10 times by others, the strong NIH syndromes... it's all so common in traditional writers circles. We're all just writers, really!
- zik 7y agoGo and Python would have to be the two easiest to use and most productive languages I've ever used. Other languages might have more powerful features but Go and Python just get more coding done more quickly and more efficiently. Other people's personal tastes may vary - and obviously do - but you can't dismiss these languages when they're so obviously very effective for many people.
- kissgyorgy 7y agoPython is NOT an easy language at all. Easy to get started with, but when you are deep diving into language features, it's starting to get WAY MORE COMPLEX than Go.
- jimbokun 7y agoDo you have any metrics to back up that belief?
- deleted 7y ago[deleted]
- whalesalad 7y agoYou had me nodding in agreement until the last paragraph. Functions are first class in Python. You can pass them all over the place and use them the same way you would in JS. You don’t have Lodash but frankly it’s not needed. The stdlib, functools and itertools are pretty much all you could ever ask for.
- AsyncAwait 7y agoIn fact, they're first class in Go too, in fact there's fewer languages where that's not the case than is, I'd imagine.
- zeugmasyllepsis 7y agoWhile functions are first class in Go, the limitations of the type system make them less ergonomic to use, I think. Without user defined generics, many of the common uses of first-class functions become a lot less convenient to use.
- hactually 7y agoDo you have an example where that's the case?
- edflsafoiewq 7y agomap, filter, fold, etc.
- TheDong 7y agoOne easy example is map functions. In typescript, if I have a bunch of "User" objects where each user has an "name" and "age" field, and I want to print a comma separated list of all those names formatted as "name -- age", it's simple. I write: let userNamesList = let userNames = users.map(u => `${u.name} -- ${u.age}`).join(", ") console.log(userNamesList). This is possible in no small part because map is generic. In go, to get the same level of expressiveness, I'd have to write the following stuff around it: func mapUsersToStrings(f func(u User) string, users []User) []string { result := make([]string, len(users)) for i := 0; i < len(users); i++ { result = append(result, f(users[i])) } } And after writing that boilerplate, I can finally write: userNamesList := strings.Join(mapUsersToStrings(func(u User) string { return fmt.Sprintf("%s -- %d", u.name, u.age) }), ", ") That boilerplate, of having to write a specialized map/filter/etc function with a for loop for every combination of types you transform between (mapUsersToStrings, mapUsersToAddresses, mapUsersToAges) is really annoying. It's harder to point to many other cases because, simply enough, people don't write such cases. The fact of the matter is just that go libraries make very sparing use of first-class functions because the lack of generics prevents it from working well, and so we end up with an entire language ecosystem where code is harder to read and with fewer simple abstractions reused across it. You can still write any code without good generics or first-class functions, you'll just have more programmers writing more code with less clean abstractions.
- zo1 7y agoCan you elaborate your criticism of python? Other than the incorrect mention of functions not being first-class objects, there isn't much I can extract in order to respond to?
- Thaxll 7y agoTypescript is a hack on top of supposly server side language that is aweful. ( Node doesn't even support int64 )
- kick 7y agoI'm sorry, what were you trying to say here? I've been staring at it for a few minutes and can't decipher it.
- stoicShell 7y agoAs I read it: > “Typescript is a hack on top of [a] [supposedly] server side language that is [awful]. ( Node doesn't even support int64 )” "supposedly" in this context meaning Js is not worth being called a "server side language", in the commenter's opinion (citing lack of int64 support for example). This also implies in subtext that "server side languages" would be of a higher category/value than languages for whatever other use-cases. I personally don't agree with any of that, just helping communication here.
- ralusek 7y agoNode supports BigInt now (integers of arbitrarily high precision).
- JustSomeNobody 7y ago> For loops take more reading to understand. A short comment would help here.
- dwaltrip 7y agoThey could also improve the language. Map, filter, and reduce are such fundamental concepts.
- JustSomeNobody 7y agoI think Go is pretty refreshing as it is. If it isn’t to one’s taste there are 3712 other languages to choose from.
- deleted 7y ago[deleted]
- Improvotter 7y agoNo, Go does not need this and I do not want it to get these useless "features". Go is simple and it gets things done with an amazing standard library. Use a different programming language if this does not suite you. Every programming language ends up with its own implementation of these "concepts" that it is hard to keep track. What is so difficult about for loops? It's simple for everyone and you don't need to learn new concepts because it works.
- bauerd 7y agoThing is that simple != easy But oh man it's the same discussion every time when Go comes up here
- StillBored 7y agoFundamental? IMHO, they are just syntactic sugar on a foreach loop. Which in many ways is bad because it provides yet another way to express the same concept, without a significant difference in the method of execution. What am I missing?
- rtpg 7y agoI had similar feelings regarding anonymous functions before, having come from a more FP background. Ways to make your Python experience nicer: - almost never try to use map or filter. List/set/dictionary comprehensions are more pythonic and will be easier in the long run - learn about standard library stuff, especially the methods on dictionaries, as well as the collections package. If you’re thinking about lodash, Python tends to have replacements that end up being better tbh - if you really want a local function, just creating an inner def statement is fine. But KISS should usually make this rare.
- reedwolf 7y ago>I'd rather just use Javascript Not a phrase you hear every day.
- erikpukinskis 7y agoMost people who hate things can recognize that other people don't hate them. For some reason, JavaScript haters always seem baffled when confronted with a person who doesn't hate JavaScript.
- throwthisaway2 7y agoThis is a symptom of people being js first. And now their entire world is js. Especially talking about constraints. And you can tell the gripe about anon functions is just lazy abstraction. Its like the opposite problem of the goto, everything here now. No abstraction.
- adamnemecek 7y agoCheck out rust. Everything about the language is sturdy.
- smadge 7y agoJust write an implementation of map/reduce/filter for every type in your go program!
- smadge 7y agoMaybe you could create some text macros to simplify the process, and then run a preprocessor on your program, and then.... uh oh.
- jnwatson 7y agoYou joke, but source code generation is the standard way to generics in go. They even have some standard hooks for it in the build system.
- gray_-_wolf 7y agoI still consider weird that results of go generate are supposed to be committed. Since when does generated code belong to the repository :/
- dangoor 7y agoI have a lot of JavaScript history, but if I were optimizing for the things you want to optimize for, I would absolutely pick Kotlin above JS+TypeScript. It's got bunches of language features, including superior concurrency, and runs on a faster runtime to boot. Unlike TypeScript, it doesn't have a 20+ year old dynamic language at its heart. In backend systems, I think that the overall architecture and management of data are much more interesting problems than the code. I feel like Go helps direct more of the thinking toward the overall rather than creating beautiful abstractions in the code. We'll see if I still feel this way in a year.
- dfee 7y agoI dislike JS, but love TS. But really, who cares about me anyway? The big picture is that JS is the English of software languages. It’s not beautiful, it steals from everyone else, and it’s never the best tool, but it’s becoming - more and more - rarely the wrong tool. I expect this trend to continue. Some genius will get JS to compile to native bytecode (WASM is the intermediate step). And, it too will be neither the best language for the job, nor the wrong tool for the job. The proof is in the pudding, nothing so wrong (JS) can be so right - and yet it survives, nay thrives.
- temuze 7y agoAs an aside, I find English to be a beautiful language. By stealing words from so many origins (Saxon words, Latin worse and Old Norse words), there's so much versatility. The Saxon words are direct and burly. E.g. oak, brash, death, iron, etc. The Latin words are multisyllabic (e.g. multisyllabic :) ). The Norse words are just plain fun (e.g. Yule, law, heathen, oaf). It's nice to be able to choose depending on context. Similarly, I find versatility to be nice in JS, as the community goes from embracing OOP to a more functional style.
- nradov 7y agoJava can do almost all of that now, and offers excellent runtime performance.
- abraxas 7y agoYes but hipsters won't be seen dead using it. It's soo not cool. Our industry is much less rational than we think.
- bovermyer 7y agoI'm not going to unequivocally contradict you here. However, I feel compelled to suggest something. What if the end goal is not to do something elegantly, or perfectly, or with superb efficiency? What if the goal is just to solve a problem in a way that's a little better than what came before?
- lonelappde 7y agoGo and Python are for getting things done effectively, not nitpicking beauty of code. That's why the authors of YouTube built YouTube in Python, and the authors of Khan Academy (re)built Khan Academy in Go, instead of bickering about nitpicks on HN.
- mars4rp 7y agoPeople here don't like C# for some reason, I write really complex business logic with it every day and it is not only easy to write, it is maintainable as well. My own JS code with lot less complexity is way harder to understand after a while.