As Steve McConnel says in Code Complete, Managing complexity is the fundamental imperative of any software developer, but how do you do that? Well Code Complete spends several hundred pages outlining some techniques and you should also read Bob Martin's Agile Software Development and Martin Fowler's Refactoring. But if you want something that you can digest in your lunch hour, I recently discovered Jeremy Miller's nice series of posts on writing maintainable code, but the one which really struck a chord with me was this one, orthogonal code. Learning how to write code without digging myself into a pit of tangled complexity has been a constant thread in my development as a programmer and he succinctly captures some of the main techniques that I've learnt over the last ten years to avoid doing just that...
- Loose coupling and high cohesion
- Tell, don't ask
- Law of Demeter
- Single Responsibility Principle
- Dependency Inversion Principle
- Open Closed Principle
Any here's a great quote:
Don't write this post off as just academic hot air, this is about consistently leaving the office on time and protecting your company's code assets because you'll be much more likely to smoothly sustain a forward progress with your existing code.