Tuesday 12 July is National Simplicity Day. A day when it’s “time to take a step back and begin to simplify our lives… by slowing down, … enjoying the simple things in life, decluttering and striving for balance”. This sounds like a good day to celebrate so, at Mitra Innovation, we thought we’d try to apply the concept to keeping it simple in software development
In software development, things tend to get complicated very often. A common mistake that programmers from many industries make is failing to break down problems into small enough pieces, which then results in very complex implementations of even the simplest problems.
Simplicity is a desirable quality attribute in any software system, thus it is best to break projects down into simple parts, then identify the core parts of the project, and begin to address them step-by-step. In honour of National Simplicity Day, we’ve listed the main software design principles that address the importance of simplicity and are dedicated to reducing, simplifying and thinking twice about what we are adding.
1) DRY (Don’t Repeat Yourself) applies to code writing methodology and usually refers to code duplication. There are many programming constructs that already exist for that sole purpose (e.g. loops, functions, classes, and more).
2) KISS (Keep It Simple Stupid) is probably one of the oldest principles of software development. It is common to try to over engineer a problem. As developers, we must keep in mind that we have limited capabilities, so increasing the complexity of a system will make its maintenance equally difficult.
3) Closely related to KISS, is YAGNI (You Aren’t Gonna Need It) which states that part of keeping it simple is refraining from adding unnecessary modules, frameworks and dependencies. It is also one of the principles of Extreme Programming (XP) which states that programmers should not add functionality until really necessary, and is also related to the “Last Responsible Moment” concept of Lean Software Development which states that decisions should be made as late as possible, so that they are made based on facts and not assumptions/predictions.
4) TDD (Test Driven Development) is said to encourage simple designs and inspire confidence. Many studies have shown that this way of writing code is much more efficient than other methods. This method ensures close to 100% test code coverage and means more time will be spent actually writing code that debugging subsequent errors.
5) BDUF (Big Design Up Front) serves as a reminder that we should not get too carried away with complex architecture especially before coding and testing takes place. There have been advocates against the necessity of such “big” designs stating that most design should occur throughout the development process. Big and detailed designs upfront can be very time consuming. It is better to start small and iterate.
6) Finally, SOC (Separation of Concerns), the most important principle in Software Engineering promotes the idea that there should be minimal overlap in the functionality of the decomposed parts of a software system. Evidently, developers want to “do all things” with every function, class or object created, but it is really important that every construct created does just one thing.
Eliminating complexity is definitely important, and we must be very careful to avoid the trap of simplistic designs which may focus only on present requirements and ignore future needs such as maintainability, extensibility and reusability. However, failure to adhere to simplicity principles results in software systems that may have complexity in the form of unneeded features, over-engineering, feature creep, software bloat etc.
“Keep it simple, as simple as possible, but not simpler.” – Albert Einstein