I’ve been fixing up the codebase of a rails app for a few months now. It was written by some smart folks, so I wanted to share some of the philosophies and design patterns they utilized.
You should always write tests. The only time its ok to not write tests is when its for public facing, non-trivial code. Or if you don’t feel like it.
A good method is 2000 lines of code
A better method is 200 lines of code, all in one line.
Sprinkle the word “TODO” as a comment throughout the codebase, but leave it to others to figure out what its for.
Instead of deleting code you don’t need, comment it out. But make sure you put “TODO” in a comment above it.
In fact, be proactive about scary commented out code. Leave
User.destroy_allas a comment in the user signin process.
Give things names that are deeply related to the codebase, but have nothing to do with whats actually going on.
A good codebase is like a puzzle; it should be difficult to assemble and be missing pieces
There is no such thing as too many relations. a
“Set it and forget it” is more than just the slogan for a late night cooking infomercial, its a design philosophy.
Good conditionals should read like
1 2 3 4 5 6