71
votes
What are the drawbacks of making a multi-threaded JavaScript runtime implementation?
1) Multithreading is extremely hard, and unfortunately the way you've presented this idea so far implies you're severely underestimating how hard it is.
At the moment, it sounds like you're simply "...
45
votes
Accepted
Is Node.js a framework?
It's a bit tough to say because these words are not well-defined. In common parlance, I think it's a bit atypical to call Node.js a framework, sure, but I'd have a hard time arguing as to why exactly ...
37
votes
Accepted
How can I prevent a user from editing my code in their browser?
You literally cannot prevent users from accessing and modifying content that you are sending them. You have no control over the browser, or which browser they use, or whether they are in fact ...
23
votes
How can I prevent a user from editing my code in their browser?
You can't. One of the fundamental rules of computing: you can't trust the client. Whatever clever scheme you think of, I can get round it if I am in control of the client.
22
votes
Accepted
Methods of separating front and back-end with full stack javascript?
It's a front-end, back-end application, with a REST interface in between. You already have full separation.
My vote is for option # 3. You seem worried about configuration, but that's kinda the ...
21
votes
Accepted
Is it bad design to internally call API endpoints from within the API instance?
There is little use of actually doing an HTTP request.
When the underlying application processes the GET request from your example, it probably calls the business layer which does some input checking,...
20
votes
Is Node.js a framework?
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
source
Node is a runtime or environment. It is not a framework. People (I feel) often get this wrong because frameworks ...
19
votes
Why do req.params, req.query and req.body exist?
All three properties are populated from different sources:
req.query comes from query parameters in the URL such as http://foo.com/somePath?name=ted where req.query.name === "ted".
req.params comes ...
18
votes
Accepted
Stateful vs non-stateful app
In the context of web applications, we call the server stateful if it maintains transient state in memory, rather than storing any data externally (e.g. in a database).
Stateful applications have a ...
16
votes
What are the drawbacks of making a multi-threaded JavaScript runtime implementation?
A decade or so ago Brendan Eich (the inventor of JavaScript) wrote an essay called Threads Suck, which is definitely one of the few canonical documents of JavaScript's design mythology.
Whether it is ...
16
votes
What are the drawbacks of making a multi-threaded JavaScript runtime implementation?
Just guessing here to demonstrate a problem in your approach. I can't test it against the real implementation as there is no link anywhere...
I'd say it is because invariants are not always expressed ...
15
votes
Optional dependencies in npm?
If you want simple optional dependencies like plugins, e.g. if you install foo you will run it colorful but if not installed, you don't have any problem and see it in gray, then you could use ...
10
votes
Are Native Promises Still Slower in Node vs Libraries such as Bluebird?
Yes
I've done some tests and it seems that as of September 2016 Bluebird is still much faster.
For the benchmarks on the Bluebird website, see:
http://bluebirdjs.com/docs/benchmarks.html
But it's ...
10
votes
Accepted
Clearing up misconceptions about a Flask backend and client-side rendering
You are incorrect about the need for separate front-end and back-end servers.
You need only one server, which can be your Flask-based server, that
provides one (static) HTML page when users access ...
9
votes
Accepted
Best practice for Restful API that perform heavy calculations (Image Processing)
You should submit your requests using a POST, and your service should return a URL that will retrieve the image once it's been processed. If the URL is accessed before the processing is complete, you ...
9
votes
Accepted
How to name two functions that could be named the same?
Adding a prefix to the function that actually does the work, like doDoStuff
Don't do that. Or you'll end up with doStuff(), doDoStuff(), reallyDoStuff(), reallyReallyDoStuff() and ...
9
votes
Should servers exit with 0 or 1 in case of caught errors?
A service that has caught and handled an error should not exit at all.
Otherwise, an exit code 0 indicates success, which for a service would be appropriate as the result of an orderly shutdown ...
8
votes
Accepted
How to implement a message queue over Redis?
If you want to use Redis for a message queue in Node.js and you don't mind using a module for that then you may try RSMQ - the Redis Simple Message Queue for Node. It was not available at the time ...
8
votes
Methods of separating front and back-end with full stack javascript?
Yes, you should separate the two and treat the front end app like a 3rd party app--you may eventually add another client, a mobile app for example, and if the first client has been built this way your ...
8
votes
What are the drawbacks of making a multi-threaded JavaScript runtime implementation?
Atomic access does not translate into thread-safe behavior.
One example is when a global data structure needs to be invalid during an update like rehashing a hashmap (when adding a property to an ...
8
votes
Heavy task exposed via a REST API
The key insight here is to treat job activations as resources that have a significant lifetime.
In a similar situation, I have implemented job creation using a POST method that returns a "202 ...
8
votes
Accepted
Storing unchangeable data in database vs in code
Data being "unchangeable" doesn't necessarily mean it cannot be changed. It just cannot be changed through the application. Set an "unchangeable" flag on each row. When true the application refuses to ...
7
votes
Accepted
node.js C++ addons to do all major computations
For this answer, I'll assume that the C++ code is ONLY well-tested and perfect security wise. If if would be actually be perfect then you wouldn't have asked this question anyways...
This is a ...
7
votes
Accepted
Update semver minor version on test updates?
I think you're overthinking it. Look at it from the perspective of the user of your package, upgrading. Is it safe for them to do with no code changes? Then bumping the 'z' version of x.y.z is ...
7
votes
Accepted
What is the point of rooms in socket.io?
Rooms are a tool in socket.io servers for keeping track of groups of connected users. You can then iterate the sockets in a room or broadcast to all of them. There's really nothing more to them than ...
7
votes
Accepted
Nodejs cluster: are there any downsides?
Several possible downsides or issues you have to code for:
Login sessions must either be stored in a central database (such as redis) that all clusters can access or connections must be made sticky ...
7
votes
What would be the reason for using asynchronous programming on a web server?
Asynchronous calls are better when your application is io bound opposed to being cpu bound (in case of web applications, almost always). Talking to the database, receiving and sending packets on the ...
7
votes
Accepted
What really is a "web server" in relation to popular frameworks like Flask, Node.js, Apache?
In IT in general we're all really bad at using words that are either
Not rigorously defined
The rigorous definition is different than the way the term is commonly used (e.g. strong typing)
In other ...
6
votes
Accepted
Confusion over Node as a "script" vs Node as a "server"
Node is a javascript execution environment. Node can act as a server (by executing a script that performs server functions).
Heroku is an operating system (sitting in the cloud) that supports (among ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
node.js × 499javascript × 144
architecture × 49
mongodb × 36
design-patterns × 25
web-development × 24
design × 22
database × 21
api × 19
websockets × 19
php × 18
angularjs × 18
rest × 16
java × 15
microservices × 14
web-applications × 12
performance × 12
unit-testing × 11
api-design × 11
server × 11
testing × 10
dependencies × 10
security × 9
authentication × 9
asynchronous-programming × 9