DEV Community

Cover image for YAGNI & KISS Principles
Hassan El-seoudy
Hassan El-seoudy

Posted on

YAGNI & KISS Principles

YAGNI

YAGNI stands for You Ain’t Gonna Need It. It’s a principle from software development methodology of Extreme Programming (XP). This principle says that you should not create features that it’s not really necessary.

Ron Jeffries, one of the co-founders of the XP, once said:

Always implement things when you actually need them, never when you just foresee that you need them.

It means that you should not implement functionality just because you think that you may need it someday, but implement it just when you really need it.

Benefits of YAGNI principle

1- Avoid spending time with implementations that were not even necessary, and maybe will never be used.

2- With more unnecessary code you write, you may discard write unit tests for them! and then you will start having more issues regarding code quality tools.

Alt Text

KISS Principle

Alt Text

KISS is an acronym for Keep It Simple, Stupid. This principle says about to make your code simple. You should avoid unnecessary complexity. A simple code it’s easier to maintain and easier to understand.

How to apply KISS principle in code?

You should eliminate duplicated code, remove unnecessary features, also don’t use unnecessary variables and methods, follow know standards of code development, also you should separate the responsibilities of your classes and the responsibilities from the layers of the project.

Conclusion

As you can see, The difference between them as you may expect from the header photo, it’s that YAGNI focus on removing unnecessary functionality and logic, and KISS focus on the complexity.

References

The Pragmatic Programmer — David Thomas and Andrew Hunt

Software Architect’s Handbook — Joseph Ingeno

Extreme Programming Installed — Ron Jeffries, Ann Anderson, Chet Hendrickson

Top comments (0)