You Need Clean Code

We all like YouArentGonnaNeedIt (Yagni) rule. Unfortunately, too literal an implementation of it results in ugly unsupportable code. I found the way to patch Yagni by saying YouNeedCleanCode (YNCC) and you need it now!

I do realize that this rule is a patch, so the proper solution should see Yagni refactored, and this patch removed. -- AlexJouravlev

That's why Yagni is balanced with OnceAndOnlyOnce. Together, these two rules form two ends of continuum, and refactoring allows you to move between them.


I disagree: YouNeedCleanCode isn't a patch to Yagni. Yagni doesn't need a patch. Yagni is (and always has been) intended to apply to new features (external or internal) that aren't driven by what you're working on right now.

To continue the metaphor: if you apply Yagni to refactoring, or to SimpleDesign, you should get a type-mismatch error :-).

Misapplying Yagni is, though, a very common mistake - the fact that it only applies to features should be stressed much more in its description, or even in its name (e.g. YouArentGonnaNeedThatFeature?). -- GeorgePaci


YAGNI is about scope. At small resolutions, it's the behavior of code, not necessarily its structure. Reduce that only if it stays readable, and put similar things next to each other.

See XpSimplicityRules.


EditText of this page (last edited June 24, 2003) or FindPage with title or text search