convention vs. configuration
June 12th, 2006I’m struggling to find a balance between convention over configuration. I’ve been pounding out another Rails project and have come to benefit from many of the conventions (eg. less time spent) . But I’ve been programming for 10 years now, and there’s one thing that keeps bugging me with “convention” style programming.
- ramp up - understanding the conventions requires significant start time to using a framework.
- maintenance - most of the code you write will be maintained by someone else. All those nifty auto-dynamic-realtime tricks may take the next programmer more time to figure out than what you saved in the beginning!
- perl effect - unless you code a framework day-after-day and use the conventions, you’ll forget them in 2 months. Just like perl.
There’s something to say for spending extra time up front to be as explicit as possible. Because the time spent up front will save in maintenance over the life of the software. On the other hand, having some amount of convention prevents chaos… For example, I’ve written my fair share of new project directory layouts with make/ ant build scripts… they all look the same, take a while to customize and perfect, and each take away time from real programming. For counter-example, the Rails ‘partial page template’ mechanism loads a file where the initial underscore of the filename is ignored as long as the filename matches a the name of class invoked at runtime and is located in the /layouts directory. Good luck tracing an application bug if you missed that tidbit in the rails documentation.
I believe in the evolution of programming by creating meta-frameworks that eliminate the minutia of the past… but at what expense?






June 12th, 2006 at 7:20 pm
I belive the answer lies in good commenting. It can be as terse as “look here: …”
June 12th, 2006 at 8:08 pm
True. Though, the comments then turn from application behaviour to framework behaviour. The ultimate goal of the framework is to serve as an ‘interface’ and shield the end user (developer) from the details…
Thanks for the comment…
June 13th, 2006 at 5:36 pm
You’re quite right. Unfortunately, I’ve found the hard way that placing a signpost to framework details can save a ton of time when revisiting.
July 6th, 2006 at 10:42 pm
I’ve written a comment over on my blog because it got too long:
http://brian.pontarelli.com/2006/07/06/configuration-vs-convention/