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 "...
Ixrec's user avatar
  • 27.8k
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 ...
amon's user avatar
  • 134k
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.
Philip Kendall's user avatar
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,...
Arseni Mourzenko's user avatar
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 ...
jfriend00's user avatar
  • 3,572
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 ...
amon's user avatar
  • 134k
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 ...
Erik Pukinskis's user avatar
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 ...
thriqon's user avatar
  • 287
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 ...
PhoneixS's user avatar
  • 323
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 ...
rsp's user avatar
  • 7,858
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 ...
Bart van Ingen Schenau's user avatar
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 ...
CharonX's user avatar
  • 1,643
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 ...
Michael Borgwardt's user avatar
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 ...
rsp's user avatar
  • 7,858
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 ...
ratchet freak's user avatar
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 ...
Hans-Martin Mosner's user avatar
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 ...
Greg Burghardt's user avatar
8 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 ...
Jared Smith's user avatar
  • 1,839
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 ...
Daenyth's user avatar
  • 8,127
7 votes
Accepted

Node.js script const variables in SCREAMING_SNAKE_CASE or camelCase

You are not really declaring a variable, but what other languages call an alias. Example in Python: import numpy as np Example in C#: using Project = PC.MyCompany.Project; For your case, from the ...
Nales0's user avatar
  • 86
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 ...
jfriend00's user avatar
  • 3,572
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 ...
jfriend00's user avatar
  • 3,572
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 ...
hangyas's user avatar
  • 134
6 votes

Docker, microservices and git workflow

It sounds like your problem is you are putting all your microservices into the same "development environment image" as you describe. So any service container can see all others. What you should be ...
enderland's user avatar
  • 12.1k
6 votes

What are the drawbacks of making a multi-threaded JavaScript runtime implementation?

Is your approach going to significantly improve performance? Doubtful. You really need to prove this. Is your approach going to make it easier/faster to write code? Definitely not, multithreaded ...
Phil Wright's user avatar
6 votes
Accepted

A good Node.js workflow for keeping packages up-to-date?

This is the workflow that I currently use for a project with monthly releases. After release, go through the dependencies and update those that have only minor changes and patch updates. Since npm ...
Alpha's user avatar
  • 449
6 votes

Is there any reason to use testing frameworks instead of assert for a lightweight lib of pure functions?

The first purpose of a test suite is to verify that your code seems to work as expected. But what if something goes wrong? The second purpose is to make it easy for the programmer to easily ...
amon's user avatar
  • 134k
6 votes
Accepted

What's a good way to deprecate your NPM modules?

TL;DR: Don't kill a puppy, give it up for adoption instead. The point of publishing a library is not the fame and glory. The point is contributing some useful functionality. Since you have published ...
amon's user avatar
  • 134k
6 votes

Is it bad design to internally call API endpoints from within the API instance?

Yes its bad(tm). The extra overhead of making the http call although needless probably wont be much of a factor. I think The real dangers are: The accidental introduction of endless loops. ie Post ...
Ewan's user avatar
  • 75.8k

Only top scored, non community-wiki answers of a minimum length are eligible