YAGNI Principle
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.
Analysis
Ask yourself whether you will need these features soon or if you are just assuming they might be important.
Planning
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.
Common Pitfalls
- 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.
Resources
Want to write for DXKB?
Feel free to contribute. People from DXKB community will be more than happy.
Related articles
ALL ARTICLES
ALL ARTICLES