4 ms·
Agree. Go is a joy to use. Java is okay but struggles with scaling unless you have the money to burn for this. To scale up servers in Java requires spinning up
by rvz 2y ago
Agree. Go is a joy to use. Java is okay but struggles with scaling unless you have the money to burn for this.
To scale up servers in Java requires spinning up highly priced servers with lots of RAM, which that is a lot of money. Using a low spec server is cheaper but you will get more JVM crashes and have to waste time doing more JVM tuning to prevent them. This is not even talking about having lots of 'microservices' to scale which that also means more money spent per month.
Using Go just reduces all of that and saves lots of money and is extremely efficient enough to rely on and it directly compiles to a single binary for deployment.
From a cost and efficiency perspective, Java is just not the answer even though it is a sound language, unlike JavaScript or TypeScript. Given a choice I'd rather use Java or even Kotlin or JS/TS. But the cost reduction, performance gains and onboarding experience with Golang is hard to beat for backend.
Would stay really far away from JavaScript or TypeScript for anything backend.
- amazingamazing 2y ago> Would stay really far away from JavaScript or TypeScript for anything backend. IDK, TypeScript types are extremely ergonomic, and if you're not overzealous makes everything very readable, and given many things are I/O bound anyway, it doesn't matter much.
- CharlieDigital 2y agoBig problems for APIs though because TS types disappear at runtime. So now you need to add in Zod or Valibot as well to validate your types. If you have view models and DTOs, then you add more Zod. Might as well use a statically typed language? Working with OpenAPI is much easier when you already have a static type system. How about database transactions? Ran into an interesting issue this week. In a .NET world, every ORM can participate in an ambient transaction because everyone uses System.Transactions. Not the case in Node because there's no such thing. Would not build backends in TS except for true microservices. The ergonomics of a Nest.js vs .NET Web API are night and day.
- amazingamazing 2y ago> How about database transactions? Ran into an interesting issue this week. In a .NET world, every ORM can participate in an ambient transaction because everyone uses System.Transactions. Not the case in Node because there's no such thing. I mean you could say the same thing about TypeScript - if your entire stack is TypeScript then there's no need for the type validation either.
- CharlieDigital 2y agoEven if your entire stack is TS, you still need validation because the submitted data from an external interface (API call) might not be valid. You can't just accept any JSON payload and expect it to be valid. In Java or .NET, it will fail at serialization when the runtime tries to map it to a static type (automatic). This is not the case at runtime with JS (because at runtime, it's no longer TS). Thus you need a Zod or a Valibot to ensure the incoming payload is actually valid by describing the valid types (even if your whole stack is TS at dev time because schema mismatches are a runtime problem). .NETs System.Text.Json does the mapping and validation using either reflection or AOT generated serializers transparently and automatically because it has static types.
- amazingamazing 2y agoYes .NET's built in SDK is larger than Node.JS's. I'm not sure what your point is exactly. As you stated just use a validation library if that's necessary. It generally is not though, you can cast the entire output to a type in TypeScript, of course this isn't validation, but it's generally good enough. Of course if you’re writing a full stack app you can share everything, validating the front and backend with the same code. Clearly that would be a strange thing to hold against .net, similar to the lack of built in validation in typescript.
- CharlieDigital 2y agoYou double up your work. What you really wanted all along are static types.
- bdhcuidbebe 2y agoI guess you just dont know the domain well enough to understand the kind of issues strong typing and compiled software is solving.
- amazingamazing 2y agoPlease do tell, what typescript, node and a few dependencies cannot do here.
- bdhcuidbebe 2y agoProvide strong typing, low memory footprint and good performance at scale. See the topic of discussion for more details.
- amazingamazing 2y agoYes, I agree, but what you're saying isn't really relevant in an I/O bound scenario. In any case, I wouldn't write a K8s operator in node.js, yes. Go is the best for that.
- bdhcuidbebe 2y agoSorry, but what IO bound scenario?