Programming Tip of the Day – YAGNI principle

Hello Programmers,

A short story about Mukund, a programmer.  Mukund’s manager used to give him lot of tasks, and Mukund used to write programs and programs.  Mukund’s manager was usually complaining that Mukund was too slow in writing programs and coming up with the required output.  Mukund was doing his best by writing good programs according to his knowledge.  Then his friend Vaibav came to his help.  He just scanned the latest piece of code that Mukund wrote and asked Mukund this question after seeing some overly optimized & unnecessary code.  The following is the conversation.

YAGNI
Image Courtesy:  rimmkaufman.com

Vaibav: “Why have you written this code even when you know you don’t need this now?”

Mukund:  “It is because I may need it later on”

Vaibav: “Are you sure you will need it later on?”

Mukund: “No, I am not.”

Vaibav: “Are you sure, this requirement/feature won’t change a lot after a few days?”

Mukund: “No, I am not sure.  It might change”

Vaibav:  “Then what’s the point in trying to write code that you may not require in the future.  You need to follow the YAGNI principle”

Mukund: “What’s that?”

Vaibav: “You Aren’t Gonna Need It.  If you are trying to do something apart from what is actually required, just go with the assumption in mind that you are not going to need it.”

After a few days, Mukund’s manager was more happier as Mukund was more quick in his turn around time and was responding well to the changes in the requirements.  Mukund was also happy.  Now Mukund knew the secret for this turnaround “YAGNI principle”

So programmers, please follow the YAGNI principle. 🙂  Don’t try to over generalize, over optimize or do anything you won’t need for now.  Know the point to stop.  You Aren’t Gonna Need It after that point.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s