| 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... |
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.