YAGNI stands for You aren't gonna need it. This principle means you should implement only required functionalities.
What Is YAGNI Principle
YAGNI is an extreme programming principle (XP) which states that you must not implement features that you assume as significant in the future.
Source: YAGNI Principle
Why You Might Want YAGNI Principle
This principle helps you to focus on the required features and not add unnecessary functionality. As a programmer, you sometimes try to foresee the future. You presume that additional requirements might come up later in development. Then, there is an assumption that the present code should encapsulate this. A lot of effort and time is involved in implementing new functionalities. Implementing additional functionalities can lead to schedule slippage, code complexity apart from unnecessary code. These features need to be maintained and may even need to be modified in the future. There are chances that the functionalities may become obsolete and may never be needed.
Problems YAGNI Principle Helps to Solve
How to Implement YAGNI Principle
Clarity on requirements and deadlines
You need to have a clear picture of the requirements and targets to prevent deviations from the required design.
Ask yourself whether you will need these features soon or if you are just assuming they might be important.
You should plan for the effort required and if it will be better to do it at present or leave it for later. This will also include the time to test and review the extra code.
- Overenthusiasm for providing the best and lasting solutions leads to adding extra features.
- Coding habits of programmers make them think ahead of time and include extra functionalities.
Want to write for DXKB?
Feel free to contribute. People from DXKB community will be more than happy.
Unit Tests are a foundation of your testing. They test the smallest pieces of code called units that have to be isolated from a system. Unit Tests are small, cheap and easy to maintain. The number of Unit Tests outnumbers any other types of tests.Read more