4 ms·
> Every little premature extraction or abstraction, every little structure meant for “when we have more of this kind”, every little setting and configuration po
by pavel_lishin 14y ago
> Every little premature extraction or abstraction, every little structure meant for “when we have more of this kind”, every little setting and configuration point for “things we might want to tweak in the future”. It all adds up, and at a dangerous rate.
My experience is exactly the opposite. Every time someone's told me, "A user's account will only ever have one event associated with it", or "An order will only be paid for with one credit card" or "A credit card payment will only ever apply to one order", that someone is wrong, and it ends up costing us days to fix.
- drcube 14y agoThat's a different kind of failure, if you ask me. Those are uses that weren't foreseen or designed for, not code that wasn't used.
- RyanMcGreal 14y agoI came here to post something similar. YAGNI has burned me a lot more times than premature optimization. Perhaps it makes more sense to draw a distinction between designing for flexibility and what we might call naive flexibility, or optimizing for use cases that a more experienced developer would know are highly unlikely to be needed.
- MartinCron 14y agoOf course, you don't (can't) see the times where YAGNI has helped you.
- dasil003 14y agoThis thread is confusing to me so I'm probably misunderstanding a few things. First Ryan's post says he's saying something similar, except it appears to be opposite to the post he's replying to. Then you say you can't see the times where YAGNI helped you, but that's neither true literally and also in spirt. Literally because it wouldn't be YAGNI if you did actually need it. But more importantly I have often discovered some architectural choice or unused feature stubbed out from years prior that saved me a ton of time in the here and now.
- RyanMcGreal 14y agoI was replying to pavel_lishin's parent comment, in which he noted that he has been burned many times by not optimizing early for flexibility: http://news.ycombinator.com/item?id=5003341 http://news.ycombinator.com/item?id=5003341 My experience is similar to pavel_lishin's, and our experiences are contrary to the author of the article. I hope that helps to clarify the first bit, anyway.
- ProblemFactory 14y agoIn my experience, this is true - but it's also extremely difficult to predict what spec changes the users will surprise you with. If you add unnecessary abstractions, generalisations and configuration, you still spend days fixing later if they weren't added in the right places. > "An order will only be paid for with one credit card" Perhaps there will be a request to allow payment in multiple parts for orders, so adding the generality from the start saves time. But perhaps instead the spec change is to allow payment of multiple orders at a time. Or partial payments of multiple orders. Or payment in foreign currencies and bitcoin. Or not paying orders at all, but marking them "completed" for accounting at the end of the year. Altogether, it's not possible to correctly predict the future feature set of the project to decide on the correct places to add abstractions, unless you are really great at product design and can read the future minds of whoever is coming up with the requirements.
- georgemcbay 14y agoI'm certainly a "simplest thing that could possibly work" type of guy as described in David's post. A somewhat unspoken but generally understood part of this philosophy is that while you don't go out of your way to make things super flexible, you also make sure you don't code yourself into a corner that will be hard to get out of should the requirements change. Knowing how to balance this sort of thing well takes years and years of experience (IME) but it certainly isn't impossible. As a side note, something taking "days to fix" is no big deal considering a big part of the desire to not over-architect is to avoid situations where a fundamental and ultimately bad assumption results in a situation that is going to take months to fix with the result being a mostly new and untested code base and all the pain that comes with that.
- dasil003 14y agoHalf of this is understanding the probabilities of certain things happening. This involves estimation of both known and unknown unknowns. The other half is knowing how to keep things flexible without having to write a lot of extra codes. Where are the architectural choke points to apply the tourniquet to allow for later expansion? Aside from being an expert in abstraction, domain knowledge is also a key component to make these decisions. You're right that it takes years to become competent at it, and even then there's a good amount of luck involved.