2,911 karma · joined Aug 10, 2018 (8y ago) · 1,352 submissions
comment 6y ago · link · parent
You can nest functions nicely and work with closures when it makes sense, if you like that sort of thing.
The async programming model is also really nice to work with.
You also don't need to create classes for every noun, verb, and adjective in your system either - when all you need is a function, you just write a function, not some weird object to hold it.
You also don't have to write a f after all of your decimal values to tell the silly compiler that you mean for 0.25 to be a float. (this one truly does not matter, but there are a lot of little things like this that add up)
I know you can do a lot of that in C#, but its just so effortless in javascript. You just need to be more disciplined about how you code it
comment 6y ago · link · parent
comment 6y ago · link · parent
Every time I ask somebody about this, they recommend slightly different practices or else insist that you can’t use a checklist approach. I partially rolled my own auth as an experiment to see what they meant and it seemed not too difficult, but I worry I missed things and hesitate to use it for production.
(Still used libraries though like bcrypt and a session encryption library)
comment 6y ago · link · parent
Having it sleep for 100ms per request is a little strange for nodejs though because it is basically simulating cpu load, even though a node server typically hands off work to an optimized library that might be disk or network io bound instead of cpu bound. 100ms is a lot of cpu work per request, no? That is specifically the sort of task node is not recommended for, since it focuses on async.
Maybe I’m wrong, I need to work on larger projects to see what loads are more typical. At my last job, the entire focus was to use node to redirect work to c++ code, databases, etc, basically just request routing.
Still, this looks rough for node. 2x to 4x difference between it and the fastest is still a significant cost for such a nice backend to work with
comment 6y ago · link · parent
comment 6y ago · link · parent
Best thing overall is to just wear synthetics that dry very quickly (pair with waterproof bag for your backpack contents - trash compactor bags are amazing for weight efficiency)