KISS DRY YAGNI
Three concepts that I’ve come across in the software development world that apply quite nicely to the real world also are KISS (which of course originated in the real world), DRY and YAGNI.
KISS
Keep It Simple, Stupid! We’ve heard it often enough, and it’s still good advice. When faced with a problem, especially one that promises to be dull to complete, it can be much more fun to come up with something elegant and/or hugely complicated just because we can. This happens surprisingly often in the corporate software development world, where the boredom of mindlessly dull tasks can be relieved by stretching one’s intellect with a bizarre solution.
Sometimes this is a good thing. But if someone is ever going to have to maintain, fix, or modify what we’ve done, they’re in for a rough time. And it can be quite an “ah” moment when we go back to our own code and can’t make sense of it. There’s a time and a place for ridiculously written code, but often KISS is still the best approach.
DRY
Don’t Repeat Yourself came out of the Agile (capital “A”) software development movement. If you’re writing the same code twice, you’re better off refactoring down to one use (perhaps referred to from multiple places). At one end of the scale this is the concept behind using maths libraries instead of writing your own. At the other end, some rather religious XP types won’t let any block of code appear anywhere twice no matter what.
My take is that this is an excellent guide that should be followed most of the time. However, if I’m writing a script to parse a couple of files that I know I’ll only ever use once, I’ll probably cut-and-paste the solution for two files rather than write a slightly more elegant DRY solution. It’s faster, easier, just as easy to read, and gets the job done.
YAGNI
You Ain’t Gonna Need It. Another spin-off from the Agile movement, this principle says that you shouldn’t build something just because you might need it some time later. Carried to the extreme it means that you wouldn’t put subtraction in your maths library if you only need to perform addition today. In practice, it means that we shouldn’t second-guess what’s required next month when writing our code this month. It’s (usually) not too hard to refactor for extension to the code. The time may well come when new functionality just doesn’t fit the current code and a major overhaul will be needed, but it would probably be a good idea by then anyway. Of course, if you know that you’ll have to persist data next month there’s no harm in making sure that this month’s code can talk to a database, but be reasonable.
(Side note: this principle seems to be violated by every J2EE project I’ve ever had the misfortune to come across.)
Example
Recently I was comparing Content Management Systems; let’s apply these three principles to a comparison of Joomla and Silverstripe.
KISS: Joomla has been around a while, and has a plethora of plugins and extensions. It changed the internal naming structure a few versions ago, so the online documentation (such as it is) is not as clear as one might wish. Silverstripe is a younger player with a smaller market share. It does the basics very well, and has a few plugins free available. Joomla is hugely configurable and has a variety of WYSIWYG editors available, while Silverstipe is simpler (and in my mind, cleaner and sleeker). Silverstripe wins on KISS.
DRY: As far as could tell from the quick assessment I had the time to do, both allow configuration to be done once to set the site up. Equal.
YAGNI: Clear disparities here. Silverstripe has either inbuilt functionality or plugins for basic requirements. It allows for reasonably straightforward development of additional plugins for other tasks. Joomla has a large amount of inbuilt functionality and about a zillion plugins (written by people of varying talent) available. There are dozens of ways of doing everything. It’s unclear what the “best” (or even “good enough”) approach is, and new users are either overwhelmed by the choice or try to install every plugin under the sun, with predictably poor results. Silverstripe the winner by a country mile.