Hacker News new | ask | show | jobs
by badminton1 3387 days ago
And as a small example:

Let's take a look at the "best practices" tutorial from nodeschool.io, one of the recommended tutorials.

https://github.com/excellalabs/js-best-practices-workshopper...

Can you list all the mistakes in this code?

- Using IEEE 754 floating point numbers (built-in Number type in JavaScript) for storing a balance is unsafe. Read more here: http://stackoverflow.com/questions/3730019/why-not-use-doubl...

- Your bank would never represent a balance in that way. They store transactions individually and they fold them to compute your balance.

- The input validation is extremely weak. Pass in: undefined, NaN, Infinity or some funny value and you will end up with a corrupted balance, or force "decreaseBalance" to increase, and "increaseBalance" to decrease.. The isValidAmount method should use "isFinite" rather than strong comparison with null.

And let's better stop here...

2 comments

To be honest, I don't think that NodeSchool intends to give a primer on how to build a production-ready balance manager. They want to teach the basics of JS, that's all.

I agree, though, that those learning services give the impression that it's just about learning how to code and maybe use some design patterns. You won't find a security/authentication course on FreeCodeCamp or one about codebase maintainability, which is a shame.

This is great to show how smart you are, but what will a beginner who wants to use this resource think when they read your comment? People have to start somewhere.
My point is to provide another perspective on what is the real entry barrier to backend programming.

Many people underestimate backend programming, and underestimate technologies only because they make use of a some scripting language like JavaScript, Ruby or Python.

I have seen millions of dollars wasted and jobs lost because of the harmful idea that backend development is for everyone and that anyone can do it after some simple training.

Production-strength backend development has become more productive because of better tooling, but not any easier. It still requires plenty of domain knowledge, discipline, rigor and attention to detail.

A functional prototype for a small startup might not strictly require a lot of rigor, but load test it or throw some millions of daily active users at it, or get a pen tester to see if it's secure enough or just advertise it and start receiving malicious users to see if holds up.