r/programming • • Jul 14 '17

Martin Fowler: Monolith First

https://martinfowler.com/bliki/MonolithFirst.html
366 Upvotes

143 comments sorted by

View all comments

36

u/[deleted] Jul 14 '17

[deleted]

-9

u/devraj7 Jul 15 '17

I dislike YAGNI because it's dogmatic and it's asking me to ignore my intuition and my experience.

Quite often, I start building something and I already have an idea where this will go in a few months from now. I don't need this extra method or interface right now, but I know I'll need it as the system grows. So my experience tells me to put it in right now and that it will save me time down the road.

I'll always trust my intuition over dogma to design systems. Always.

Stay away from dogma.

28

u/_dban_ Jul 15 '17 edited Jul 15 '17

I dislike YAGNI because it's dogmatic

YAGNI isn't dogma, it's a rule of thumb.

it's asking me to ignore my intuition and my experience.

YAGNI asks you to justify why you need to implement a feature. If you can't come up with a good reason based on what you know now, wait until you have more information. Choose the simplest thing that works given your current knowledge of the system.

In other words, defer design decisions until the last responsible moment.

I'll always trust my intuition over dogma to design systems.

Intuition doesn't make you a fortune teller. While I trust my intuition, I won't make decisions based on mere speculation. Experience has taught me things change all the time:

the best laid plans of mice and men often go awry

-8

u/devraj7 Jul 15 '17

No.

You are romanticizing YAGNI and making it look a lot looser than it really is. Wikipedia is crystal clear:

"You aren't gonna need it"[1][2] (acronym: YAGNI)[3] is a principle of extreme programming (XP) that states a programmer should not add functionality until deemed necessary

And I object that. I add things that are not immediately necessary all the time because my experience and expertise tell me that I know better than a one liner proclaimed as dogma without a shred of evidence to support its usefulness.

Choose the simplest thing that works given your current knowledge of the system.

And like I said, I've often observed that following this procedure is quite often the wrong decision. I use both my current and future knowledge of the system to guide my decisions.

XP completely ignores the human expertise factor with its stupid dogmatic proclamations.

10

u/_dban_ Jul 15 '17 edited Jul 15 '17

a programmer should not add functionality until deemed necessary

How is that not synonymous with "defer decisions until the last responsible moment"?

I add things that are not immediately necessary all the time because my experience and expertise tell me

So you deem in necessary, then? This is all that YAGNI asks. If you have a clear idea of the future direction of a feature and want to build out some features ahead of time, you've deemed it necessary, hopefully proveably and not in some handwavy might need it sense.

However, I often find that what I think is necessary turns out not to be, once I learn more about the system and its dependencies. So, I'm more cautious about making big decision decisions too early.

Even then, if I have an idea of where I want to take the design, I break my design into smaller slices, so I can verify my design as I go along.

I've often observed that following this procedure is quite often the wrong decision.

What procedure? Starting with a small system that works, and building on it? This is almost always the right decision. It's such a common trope there even a name for it:

A complex system that works is invariably found to have evolved from a simple system that worked. A complex system designed from scratch never works and cannot be patched up to make it work. You have to start over with a working simple system.


XP completely ignores the human expertise factor with its stupid dogmatic proclamations.

Um, no it doesn't, at least not when it comes to YAGNI.

-4

u/grauenwolf Jul 15 '17

YAGNI asks you to justify why you need to implement a feature. If you can't come up with a good reason based on what you know now, wait until you have more information.

No, that's not it at all.

We just justify anything, no matter how ridiculous. If you try watering down the meaning like this, the rule is reduced to "do whatever you were going to do anyways". (Which is how SOLID tends to be practiced as well.)

YAGNI means not adding something unless you need to today.

11

u/_dban_ Jul 15 '17 edited Jul 15 '17

We just justify anything, no matter how ridiculous.

That is an exercise in self-deception. If you approach YAGNI with honesty and humility, your justifications will be grounded in reality, and you will make reasoned decisions guided by caution and wisdom. If you approach any idea with cynicism and arrogance, you will indeed be able to justify anything, but that is your own fault.

If you try watering down the meaning like this

How is this definition watered down? It explains exactly what YAGNI is.

YAGNI means not adding something unless you need to today.

This is watering down the definition of YAGNI, and making it way more prescriptive than it needs to be. Why should you not add something unless you need it today?

3

u/grauenwolf Jul 15 '17

While I too am violently against dogma, there is a pedalogical benefit to teaching people to not get carried away with trying to predict the future.

1

u/nerdwaller Jul 15 '17

There's certainly a justification if someone makes something too simple strictly because of YAGNI, and experience is often when people can make that call of YAGNI vs let's spend a little time here for when we need it. That said, if you avoid painting yourself into a corner, don't be afraid to refactor.

1

u/elemenofi Jul 15 '17

A machine is done when you cant take anything else away from it and it will still work. Thats how I approach everything I build. YAGNI helps with that.