Here are some of the principles that every software professional (be it an Engineer, Architect or Manager) needs to understand and apply them.
YAGNI – You Aren’t Gonna Need It:
The YAGNI principle states that a developer should not build functionality just because it might be needed later. Basically it says do not build any code/features for a product that are not currently needed. This principle will prevent you and your team from spending countless hours planning for some grand, imaginary and unknown future scenario.
YAGNI will help you and your team from over engineering something based on what you think will be needed in the future. When applied in the right sense, time is not wasted on
1) Coding functionality that is not currently needed
2) Rewriting future functionality actually needed but is quite different from what was anticipated.
It is based on the idea that things change with time. Following the YAGNI principle will save you and your team time in two ways. First, you won’t spend time now on writing code that is not needed now. And, second, when the time comes when the new functionality is needed, time is not spent rewriting and refactoring, but is focused on writing once and writing well.
By no means is YAGNI against advanced planning and thinking, it only encourages taking “stuff” into consideration now, but postponing the implementation to the future.
Always Ask the YAGNI question:
“What are the chances that You Aren’t Gonna Need It?”
KISS – Keep It Simple, Stupid:
KISS principle states that everything should be done as simply as possible. Applying the KISS principle helps teams from over complicating problems. In my experience in the world of software development, developers tend to relieve the boredom of routine jobs by implementing an over complicated solution even when a simple working solution already exists. A successful implementation feels great and exhilarating until someone else needs to fix, maintain or modify the implementation. I must confess that I have done that many a time. One of my mentors once gave me a good analogy that I will not forget: An expert is someone who makes the job at hand look as simple as it is and not vice versa. When ever we get back to our own code and start scratching our heads that is a sure sign that something got more complicated than it needs to be. Do not use all the fancy OOP, threading, and frameworks just because you can.
It is very simple to Implement the KISS principle. Whenever you come across a solution to a problem ask yourself ” is it really the simplest way to do it? ”
DRY – Don’t Repeat Yourself:
DRY is a principle that encourages to automate/extract tasks/code that we seem to be repeating again and again. DRY is aimed at reducing duplication and having a single point of maintenance. The DRY principle can also be applied to implementations. Implementations should not be generalized as a framework before the need to repeat it again and again is determined.
Premature optimization is a term coined for the practice of trying to optimize the code to run faster when the code/functionality to be implemented is in a fluid state. Do not forget the well-known statement ” get it right then make it faster.” Do not get hung up on writing a fast-optimized code before getting the functionality right. The rationale is that it is most likely that the optimization that might be done prematurely might account to less than 3% of the actual bottlenecks. The following quote from Donald Knuth in “Structure Programming with go to Statements” summarizes the problem perfectly:
” Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all-evil. Yet we should not pass up our opportunities in that critical 3%.”
Principle of Least Effort:
This principle states that people, and even well designed machines, stop looking for better solutions once a solution that minimally matches the acceptance criteria is met. Applying the principle helps us to find the most effortless paths to solve problems. It promotes a quick and simple design over elaborate systems designed by committees.
The Pareto Law of 80/20:
This law in the field of software states that 80% of a system’s users will use only 20% of a system’s features. By understanding this rule and identifying the 20% of the features that 80% of the users use, we can concentrate the resources and time on those 20% of the features to produce a better product.
Many senior developers and architects, even though well versed in these principles, tend to apply them only when they feel like it and miss their spirit. As one of my mentors calls it “Resume Driven Development.” , teams tend to over complicate and try new API’s and frameworks and end up creating wastage disregarding the business goals and objectives. This is also the reason why more than 90% of the projects do not see the light of going live.To avoid this waste, it is important for management teams to become well versed in the field of development and good practices from both implementation and design standpoint.