Did the authors of The Pragmatic Programmer forget about YAGNI?
The Pragmatic Programmer is highly recommended by many people. I've just finished reading it, and I can see why people recommend it, although I would point out that Code Complete covers almost all of the same material in much more depth.
However, one thing t开发者_运维问答hat bugged me was the way the authors never mentioned any downsides of flexibility, generalising, and leaving room for future development. Those concepts are all very good, but what happened to the principle of YAGNI (You Ain't Gonna Need It), which prevents developers wasting their time implementing flexibility that's never going to be used?
A search of SO reveals 400 questions about YAGNI, so I doubt the concept was too obscure for the authors. I am, of course, nowhere near as experienced as them, so why didn't they mention any use of restraint throughout the book?
Thanks.
They don't call it YAGNI, but there is keyword on page 11 that has at least the the same focus:
Know When to stop!
They didn't forget. I think the book just predates YAGNI becoming well known.
[YAGNI] prevents developers wasting their time implementing flexibility that's never going to be used
Implementing flexibility doesn't necessarily take more time. In my experience it is something that can (and should) be part of your natural programming style. IMHO code that is inflexible is generally due to poor programming practices.
精彩评论