4 ms·
Plus, using JavaScript on both the server and the client made writing multi-purpose code very straightforward. You really don't want to mix server-side and cli
by maratd 15y ago
Plus, using JavaScript on both the server and the client made writing multi-purpose code very straightforward.
You really don't want to mix server-side and client-side code. Although I use the same library (mootools) on both the server and client, I keep the code separate. The only exception has been a class that I wrote to dynamically generate PDFs. That has been useful both in the browser and on the server.
- shazow 15y agoWhy not? As always, this is a huge "it depends". Take game development for example, it's very common for huge overlap between client code and server code, both often written in the same language for this reason.
- maratd 15y ago> Why not? Because server code and client code do very different things. Once you start using node.js you start to feel that real hard. Server code is accessing the database, client code is rendering to screen, etc. Mixing that is always a bad idea, even in games. You'll end up with spaghetti code. You will also probably have different guys working on server stuff and client stuff. Keeping it separate will make things easier there too.
- asynchrony 15y ago-- Although I use the same library (mootools) on both server and client, I keep the code separate. -- So you really don't want to mix server-side and client-side code -- except when said code is useful both on the server and on the client?