What the hell is POODR?
POODR is short for Practical Object-Oriented Design in Ruby, which is a fantastic book by Sandi Metz that teaches you how to write object-oriented code that won't make you cry when you have to maintain it. It's definitely one of the best programming books I've read and the lessons in it can be applied in pretty much any language .
If you just leave this post right now and go and buy a copy then my work is done - the rest of these posts are optional. You can get it from Amazon in print or on Kindle) or see the Sandi's product page for more buying options.
Short answer: For fun & profit.
Meanwhile you're still driving it like a Smart car.
- Files with hundreds, sometimes thousands of lines
- Loads of unrelated code in the same modules
- Methods that seem to go on for ever
- Objects that cover multiple responsibilities
- Constructing the "Pyramid of Doom"
- No tests at all!
The Node ecosystem is better but still doesn't escape bad practices altogether - it's great that the community is committed to the unix-style ethos of "small modules that just do one thing", but when you start putting those modules together in an app it can get just as messy.
It's especially weird as I don't write code like that in Ruby. If feels like I'm dragging along the cultural baggage of the years when JS didn't have a module system, or getters and setters, or higher order array methods like
reduce. And it ran in the browser 99% of the time.
This is not the world we live in any more. We can
require things, natively in Node and in the browser with Browserify, RequireJS or one of the ES6 module system backports. We have some best practices on object creation, composition and inheritance. We have tools to handle writing async code like promises. We even have getters and setters (if we're not targeting IE8).
Given that the ecosystem has drastically improved, and will get even better with the next version (ES6) of JS, it's time to go cold turkey on bad practice. It's doesn't take much effort to write good, clean, modular code - we just need to be rigorous in our application of the best practices we use in other languages.
But what are you actually doing?