Design Dithering


When you break out of the “new programmer” mindset and begin thinking in terms of organisation, patterns, and good design, I think there’s a real danger of hitting a development wall. What actually is the correct way of implementing a shopping cart? Should you use a three or four tier application design? My outlook on this is pretty simple:

It doesn’t matter.

The Domain Driven Design book teaches a lot of interesting stuff, some of which can contribute to a brain freeze. So many new concepts can mean that there are a lot of possible avenues of approach for any given problem. But in my eyes, one of the most valuable lessons that Eric Evans gives in that book is that refactoring is key. If I find myself struggling to adapt the right approach, I take the simplest route, safe in the knowledge that if I’ve done it wrong, my application will let me know, big time. If I’m following a loosely coupled design, no single refactoring should have a huge impact on the rest of the application.

So if you find that you’re struggling for a solution, take the simplest, quickest – even do a dirty hack! – and know that next week, if that decision comes back to bite you, you can just refactor it out.

Javascript Patterns & Practices