Hacker News new | past | comments | ask | show | jobs | submit login

You don't write js because you like, is because is a competitive advantage:

- Write in one language only for both client and server side. Why is good? You just need js devs, no need to duplicate validation and other logic. I'm making a game right now and has js on the backend. I want to make the game single player, now I can just import a file from the client side and <<Boom!>> now is single player. If your backend is in java, good luck to make it single player.

- Compare a website to an installable app. Who is more likely to gain more customers all things being equal? If you click on a link from google, is more likely to browse a website rather than installing an app.

You could compile java to js, but is a nightmare to debug and you are far away from the real code. You will have a lot of issues.

There are more benefits of js of course.




I really don't get how JS on the client and the server is any real advantage - besides sharing some syntax, the models and paradigms are so drastically different it might as well be two different languages. Why make the server so bad when you don't have to? I think JS has its place despite it's flaws, but for the sake of sanity I can't imagine ever using it on the backend by choice. If you want the ease of express, use Flask.

If you can't write your backend in something else and use the same devs, you have bad devs. It's not that hard to pick up a language if you understand the concepts needed to write a client and a server.


> I really don't get how JS on the client and the server is any real advantage

from my own experience, using single language has huge influence on overall code quality. Makes you understand it much better, comparing to situation you must switch between multiple languages. As you gain more experience in it, the less obvious bugs you'll make (just by knowing what's good and what's wrong).

The worst js code I see, is coming from programmers for whose javascript is their secondary (or third) language. They simply don't understand the basics of it. For example they use timeouts to make asynchronous code synchronous, etc... Then bitching on internet how bad language it is.


Can I ask if you've ever programmed in another language on the backend? I've done plenty of JS and many backend languages and I'd never consider using JS on the backend.

> from my own experience, using single language has huge influence on overall code quality.

From my experience, JS code is really poor quality and overly complex (looking at your build chain) even when written by an expert.


i could argue with you here, but i rather skip


My code is barely coupled with any server engine. My code is just agnostic. Everything is a function. Then I put some wrapper to connect my function to express API or sockets. My code probably is not aware is running on the client or server, nor should be aware of that.

For me works amazingly. I couldn't see myself using anything else on server.

It's not hard to pick up a new language, but changing every 5 minutes it is, especially when you create a new feature.

I think I have 75% of the code shared between client and server side. Again, I can't see myself duplicating so much code and testing it.

I use typescript by the way, so it's pretty good imo.

Just think of all the utils that are shared between client and server side.

Of course I'm talking about web applications with streaming data, not simple webpages.

In a project before we had some functionally that was done on the client side, then somebody decided to move on the server side. Has to be written again in Java from scratch. It's doable, but it's more expensive.


>My code probably is not aware is running on the client or server, nor should be aware of that.

Client- and server-side are very different in terms of network connectivity, CPU and other resources. On the backend you can get by with N+1 queries if the DB is running on the adjacent VM. On the client side, hardly.


The backed's job is to give the frontend what it needs, so at some point it has to make the objects that the fontend will consume and instantiate. That point at which the two realms join is a source of lots of potential reuse, from model objects, to the business rules surrounding their use and structure. Also consider things like validation, javascript-driven server-side rendering, etc




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: