Two programming principles that have become part of my own philosophy are KISS and YAGNI. As both a developer, and a manager of developers in a corporate environment, I’ve seen the necessity of these two principles. As a development manager though, these principles can mean the difference between a future focused on adding value to your company, or a future crippled on maintaining legacy code.
KISS (Keep it Simple Stupid)
You’ve heard this phrase before, and it can apply to many situations. In the world of software design KISS encourages you to keep your design as simple as possible. Quoting directly from ExtremeProgramming.org:
A simple design always takes less time to finish than a complex one. So always do the simplest thing that could possibly work next. If you find something that is complex replace it with something simple. It’s always faster and cheaper to replace complex code now, before you waste a lot more time on it.
Remember, the more complex it is, the more likely it is to introduce bugs, which in turn increases QA and bug fix time. The more complex it is, the more difficult it will be to maintain, months/years from now, by another developer who inherited your code. As a manager in a corporate environment this is always on your mind.
A quote I’m known for saying repeatedly during the design phase of a project: “don’t build a skyscraper when all you need is a house.”
YAGNI (You Ain’t Gonna Need It)
This principle is one of my favorites. It’s simple, don’t build something now because you “think” you may be able to use it in the future. You know what I’m talking about. You’ve either done it, or you’ve seen it. Maybe it was that simple function you wrote for your app that you swore could be used by other apps, so you wrapped it up in some uber-OOP design pattern or exposed it through that cool new message bus everyone was talking about…and no one has used since.
Another great quote from ExtremeProgramming.org:
Keep the system uncluttered with extra stuff you guess will be used later. Only 10% of that extra stuff will ever get used, so you are wasting 90% of your time.
Ignoring YAGNI is a cause of developer scope creep, of developer gold-plating. It’s what makes your development manager rub his temples during status meetings because you’re running late on what should have been a simple feature.
- Build the simplest thing that could possible work.
- Build for today, not for some future that will more than likely never happen.
The developers I’ve respected the most, the ones that became my “go-to developers” because I knew their designs would be simple and their work would have very few bugs, all followed these principles.