×

Smok Code's video: What is YAGNI coding rule and why it helps

@What is YAGNI coding rule, and why it helps?
Useless work is the worst! And it's especially expensive in programming. Avoid useless work at all cost, and reduce the scope whenever you can - this is your for today! Clean Code (R. Martin) - US: https://amzn.to/3jVUEDU | UK: https://amzn.to/2Iij4Jz Best Practices for Programmers - US: https://amzn.to/2SPRSEg | UK: https://amzn.to/2Fr2h6e What is YAGNI coding rule, and why it matters? You Aren't Gonna Need It - that’s what YAGNI stands for. Simple but effective acronym - invented as part of Extreme Programming (or XP for short) by Ron Jeffries. He said on his blog: Always implement things when you actually need them, never when you just foresee that you need them. Imagine that you’re writing a class to store some records, and you’re asked to write a method called getAll(). You might think: well, since I’m doing this I might as well write a method called getById() and maybe getByName(), but hey: YAGNI. That’s not what the doctor ordered, don’t put yourself in that situation. This may seem like an obvious thing to do: don’t write software unless you were asked for it. My experience shows that in many cases programmers try to futureproof the code and add features that they think their customers are going to use. Hardly ever that is the case, and the code ends up being kept in the repository for years until someone decides it’s about time to remove it. Another equally possible scenario is: requirements change, and code that was prepared to be used later - actually has to go, meanwhile hours spent on writing, testing, reviewing and discussing these precious lines could go elsewhere. Maybe they could be spent in the break room, playing games or drinking coffee. Some might say that you could actually develop some other much needed code with that time - who knows? As programmers we optimise our code trying to do all the required work with a minimal amount of CPU cycles, but somehow we often fail to realise how our mental cycles are wasted. Invoking YAGNI during meetings can be very powerful - both to deny doing things that aren’t really needed, and to prevent useless code from entering the repository. And remember: the cheapest software is the one that you didn't write. You aren't gonna need it! Subscribe, and I’ll see you in the next one, cheers!

50

12
Smok Code
Subscribers
15K
Total Post
87
Total Views
318.6K
Avg. Views
5.7K
View Profile
This video was published on 2020-10-23 19:30:01 GMT by @Smok on Youtube. Smok Code has total 15K subscribers on Youtube and has a total of 87 video.This video has received 50 Likes which are lower than the average likes that Smok Code gets . @Smok receives an average views of 5.7K per video on Youtube.This video has received 12 comments which are lower than the average comments that Smok Code gets . Overall the views for this video was lower than the average for the profile.Smok Code #QuickAnswer #programming #tech #softwaredevelopment #developer #sde Clean has been used frequently in this Post.

Other post by @Smok