YAGNI - "You Aren't Gonna Need It"

YAGNI

This is a concept I’m familiar with and only recently have been starting to consider more with the code I’ve been writing. However, it was only today that I realized that there was this acronym (YAGNI) associated with it… you know, TIL and all that.

I’ve been much more conscious of code complexity lately, and this approach goes well with keeping it simple (KISS). The less code you have, and the more focused it is, the easier it is to deal with in your project, both in editing/maintaining and debugging.

So, something to think about if you’re not doing it already. Extra features are nice, but if they’re not needed, do you need to add them? Maybe you will later, but its better to do it then since the requirements for your project may have changed by then as well.

Concepts and quotes that invoke them - like YAGNI - can be appealed to so one can examine the temperament of their thinking.

Action speak louder than words.
The pen is mightier than the sword.


It’s tricky communicating with people who seem to have been recently appealing to an opposite concept.

1 Like

I find the exact opposite a lot more entertaining, of course not as practical, ideal or encouraged however. :stuck_out_tongue_winking_eye:

How To Write Unmaintainable Code
https://www.thc.org/root/phun/unmaintain.html

I’ve read something like this before - not the same one, but something very similar. Its fun to see how much you recognize seeing in practice (not that I’m pointing any fingers, Flash Player codebase…)

edit: I like this one:

for(j=0; j<array_len; j+ =8)
{ 
total += array[j+0 ]; 
total += array[j+1 ]; 
total += array[j+2 ]; /* Main body of 
total += array[j+3]; * loop is unrolled 
total += array[j+4]; * for greater speed. 
total += array[j+5]; */ 
total += array[j+6 ]; 
total += array[j+7 ]; 
}

This would have been good advice for me. I often found myself planning and coding for every eventuality rather than actually writing the program I had originally intended.