4 ms·
I am in the same boat as you, Java longtimer-to-NodeJS/Typescript transplant. My take after two years of production development with NodeJS is that the core li
by EdSharkey 5y ago
I am in the same boat as you, Java longtimer-to-NodeJS/Typescript transplant.
My take after two years of production development with NodeJS is that the core libraries and runtime is fine, but NPM is a hot mess. The vanity projects and resume padding crowd out the library gems.
I do not like that compiled binary code can be included so casually into NodeJS apps and 3rd party libs, so I do not like to use it for deploying microservices to consumers. And for those use cases we stick with the JVM.
For developing internal apps and non interactive systems, NodeJS is very productive once all your mountain of tooling is in place. TDD is a must for large codebases, and we find Jest to be very capable and fast.
Exception handling is dependent on what middleware and libraries you choose impose on you. Generally speaking, you should have your code fail fast and let all thrown Error objects bubble up to a top-level error handler. Always throw objects that extend Error so that you get a stack trace that you can log out in the handler. Using async/await universally should allow your errors to bubble out through promises. I agree, exception handling is a tangle.
Performance is as simple as, use es6 classes where you can since Chromium can JIT those most easily. Set up your object properties in your constructor and do not dynamically add properties in any other methods nor change the properties' types. Assigning null or undefined to properties makes things a little slower, if you can find ways to avoid that, the JIT will favor you. Don't sweat it otherwise, Chromium is bloody fast. Get creative with WASM or workers if you absolutely must go faster, diminishing returns.
To your issue with lack of sage advice and books, just know that your having had that thought makes YOU the sage! You are the one you have been waiting for. Keep calm and own that role.
Be the tastemaker; the tools and libraries you picked are the best because you knew what worked best for your architecture and team. The low level system is not a mystery to you. You read the Promises spec and understand it the best of all your peers and find yourself explaining what's going on far too often to people who should know better. It's a toy runtime, or at least it started its life that way, and it needs your discipline.
- eurasiantiger 5y agoNode.js doesn’t run on a full Chromium; just its JS engine, V8.
- EdSharkey 5y agoUgh, I can't believe I made that mistake. Yes, just the V8 engine is included.