#47 YAGNI

This is post #47 of my #365 day series.
Photo by engin akyurt on Unsplash

Have you ever done something just to be doubly sure you didn’t mess things up? Perhaps a triple knot when a double knot would’ve done? There’s a concept in Extreme Programming (I swear I didn’t make that phrase up) call “You Ain’t Gonna Need It” (abbreviated YAGNI). So now you know I didn’t jut come up with the title of this piece by mashing a bunch of keys together. YAGNI describes the common pitfall in coding where folks overload functions and features that they think they will need later. You might say to yourself “What’s wrong with that? That person sounds like they are doing a good job and being diligent and planning for the future.” Well, yes and no. The problem with over-planning in the present for the future when it comes to programming is that things seldom go according to plan. Either the product manager and/or the client will want changes and may completely invalidate the additional code, which means all of that extra planning and coding was for naught.

What’s a better approach? Get from point A to point B in as few steps as possible. Be laser focused on completing the task and the desired effect. That doesn’t mean don’t account for potential errors and smoke test your code, it means get the job done first and foremost and don’t get too cute with the execution. All of this comes with time, which is one of the reasons why I write every day. By forcing myself to write every day it helps me develop the correct pattern recognition for figuring out what works and doesn’t work in terms of coming up with a formula, or as some may refer to it, a style by which I write. The practice of coding is the same thing. You must code every day if you want to be better about it. Intent is nothing without action when it comes developing the second nature reflexes for figuring out solid coding patterns.

The concept of YAGNI also applies to contract drafting. I often see lawyers try to “add value” by throwing in additional words and scenarios that are either unlikely to happen and/or offensive to one of the contracting parties. Why? Because the lawyer usually anticipates some farfetched breach scenario that would be too elaborate to even execute on. I call those “Jason Bourne” scenarios because the probability of it occurring are close to zero, but the probability that I’ll have to waste time or brain cells discussing it are far greater than that. Usually (and I say that intentionally because there are certainly exceptions), there is a way to write a phrase that captures 90% of the cases that makes it easy for the parties to comprehend and helps the teams avoid discussing bizarro Jason Bourne scenarios. To avoid the unnecessarily wasted time, practitioners of coding and contract drafting should take the YAGNI concept to heart, which I suppose is sort of a YAGNI-esque sentence since that’s what the whole article is about.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store