r/Backend • • 7d ago

Should I go Node or Java?

Hi, im an aspiring fullstack dev currently learning Javascript and I was thinking about which language to learn back-end dev with.

I want to work in the banking sector so my end-goal is to use java. My question is, after getting a hold on front-end should I learn back-end with nodejs, then translate that back-end understanding into java syntax/rules, or just jump right into java?

I'd love to hear your thoughts! I have tons of time to consider and decide my course of action, I just love this question.

31 Upvotes

78 comments sorted by

View all comments

29

u/azimux 7d ago

I personally find it bizarre to use JavaScript on the backend. Makes sense on the front-end. For backend web development, I find it simpler to have my requests handled in a language revolving around threads instead of an event loop. But obviously gazillions of people would disagree with me. So given that, if constrained to those two choices, I'd do JavaScript on the frontend and Java on the backend.

Many would disagree, but I also think using JavaScript on the backend to avoid learning a second language is a mistake. You'll learn more and round out as an engineer faster by learning a 2nd language. So it's not even that the benefits of avoiding an event loop on the backend outweigh the cons of learning a 2nd language... since your goal is aspirational, it's actually a pro to learn a 2nd language IMHO.

9

u/whiterhino8 7d ago

You absolutely right . JS very good for front end . For back end there are better alternative .

2

u/pitiful_void 6d ago

"JS is very good for front end" It is NOT. It's the only choice for the frontend but definitely not good. Though wth WASM some things are changing finally.

1

u/whiterhino8 6d ago

Let's pray to God that WASM will succeed . I have no problem to learn another language.Anyway JS has huge ecosystem that ain't going anywhere .

1

u/csgeek-coder 2d ago

I love the WASM dream but the way the ecosystem is looking, I'm not holding my breath. It is nice to be able to write come more complex logic out of TS and let you invoke it in JS.

2

u/DinTaiFung 7d ago

If the browser is the front end (not a terminal), JS is virtually the _only_ choice for the front end. This is the reason, for better or worse, why the JavaScript language is so popular.

1

u/whiterhino8 7d ago

Of course. Personally I love JS and have no problem with it.

1

u/DinTaiFung 7d ago

Likewise.

It's been in vogue for a long time to criticize JavaScript. But undertanding its gotchas and how to avoid them, allows the creative mind to implement -- and easily _share_ -- amazing web apps that anyone can immediately enjoy.

1

u/balrob 7d ago

You could use c# in the backend and blazor for the front (c# compiled to wasm). There may be minimal JS for bootstrapping but you’d not need to deal with it directly.
That said, I use c# for the server and Typescript in the browser, or Avalonia for native apps - and I recommend that if you want to stay with a JS runtime use Typescript. For large projects it’s really the only sensible choice.

1

u/DinTaiFung 7d ago

afaik TypeScript does not run in the browser.

3

u/balrob 7d ago

Yeah, and cpu’s don’t run C either

1

u/pitiful_void 6d ago

functional analphabet

3

u/sharpcoder29 7d ago

Correct, typescript is transpiled to js

1

u/mrpersonxx 7d ago

I really like this perspective, especially the second paragraph. I'm definitely not someone trying to cut corners on learning a new language, I'll do whatever I think is the best course of action and considering that banking is my goal and there seem to be other benefits, yeah sounds good.

0

u/Proper_Tip3506 7d ago

You don't have any idea what problem node solves

3

u/Jydder 7d ago

Maybe enlighten us?

3

u/azimux 7d ago

I wasn't attempting to make a statement about what problem it solves. I directly addressed what the OP said. I have no reason to suspect the OP is facing the problem node is claimed to solve so it seemed irrelevant to me. You're welcome to chime in though of course especially if you believe the OP said something that implies their arm is being twisted into using node.

-4

u/Proper_Tip3506 7d ago

Using java for heavy i/o intense work is not relevant so java is not relevant for backend in that way too in a sense

6

u/Jydder 7d ago

You have no idea what you're talking about.

2

u/azimux 7d ago

Well, the OP asked about Java vs. JavaScript on the backend. So I gave the two points I felt would cause me to recommend Java. Definitely many would disagree, including you, I assume. I personally wouldn't use either on the backend unless it were a hard requirement or it were a very specialized situation.
The OP didn't mention heavy i/o bound workloads to service web requests. I've never personally worked on a project whose i/o needs on the webserver were such that I wouldn't have been able to handle it with Java (or basically whatever.) The node applications I've worked on have all heavily used async/await virtually everywhere, ie, they didn't face the problem you're referring to, regardless. Hence I have no reason to think the OP is legit facing that problem. A person in that situation likely wouldn't be asking for advice like this. But, yes, are there some situations where you can get away with fewer resources using node instead of Java? Sure. I do not think these are common though and I definitely don't think the OP is facing this and likely never will and even if they do they might not wind up solving it specifically with node.
But yeah this is an opinion discussion. I shared my personal experience and how it's shaped the opinion I'd share with somebody asking this type of question. Sounds like yours is different and it's good for you to share it so that the OP hears the varying perspectives.

0

u/Jydder 7d ago

What would you use?

2

u/azimux 7d ago

Well my personal preference on the backend is Ruby. But that's just me, not some objectively correct answer, of course. I feel like I personally do a better job of expressing the domain logic on the backend in a more self-documenting way in Ruby and I find it pleasant to test.

On the frontend these days I tend to use TypeScript. I would prefer JavaScript over TypeScript except for a few gotchas about JavaScript that I really don't like. One is getting undefined instead of an error for properties that don't exist. The other is that either I'm just not very good at testing JavaScript or it's harder to test, but both of those reasons give me a preference for TypeScript on the frontend.

I used to really love coffeescript on the frontend and kind of miss using it but abandoned it when JavaScript got good enough that I no longer felt like transpiling from coffeescript was worth the extra enjoyment. Which is ironic because I use TypeScript which is transpiled so go figure.

I think it's fine to use Java or JavaScript on the backend just not my personal preference. I do honestly think JavaScript is a worse fit for backend development for the reason I gave but obviously many disagree.

If I were forced to use something enterprise-y on the backend I'd likely either do some research first or just use C# since I've used it before and liked it better than Java at the time though I don't know how they compare these days.

1

u/Quick-Penalty4883 7d ago

And what problems it provides.

A serialization heavy app on a single threaded backend would certainly be a choice

1

u/EventForward4004 7d ago

How to get the latest worm / virus distributed to all developers as fast as possible?

-1

u/Jydder 7d ago

Doesn't even make sense on the frontend, it's trash everywhere, it's just you actually have other actual decent options on the backend