James Watson
Posts: 2024
Nickname: watson
Registered: Sep, 2005
|
|
Re: I think Open/Closed Principle has issues too
|
Posted: Aug 4, 2011 12:49 PM
|
|
> > What YAGNI says is: If you're writing software for > > an 8-bit camera, don't write 16 bit algorithms. > > But that's the idea I don't agree with. > The point was that I spent the extra time to develop > templated code so that I didn't write 8 and 16 bit > image algorithms, I wrote one algorithm that worked > for any bit depth. And if the algorithm needed updating > then it was updated for all image types. Writing for just > 8 bit depth would have been short-sighted and dumb.
While there is something to YAGNI (I'll wager that we all have worked with over-designed systems), I agree strongly with John that blindly following this is stupid.
Where I work, we are building the Nth version of a large number of systems. We have to do this because of the brittleness of the previous implementations. So when we are building say a fundamental web service specification, we already have a pretty good idea what it needs to support. Basically, the business we are in hasn't changed and we needed to have a certain functionality 5 out of the last 5 times we've done it. It makes no sense for us to pretend like we don't know we will need it the 6th time but the people who walk in off the street talking about stuff like YAGNI don't have that background information.
Certain aspects of system design are extremely costly to add in later. For example, how fault-tolerance is implemented can fundamentally change the approach of a system. The best analogy I can think of is that when you build a house, you better think ahead before you lay the foundation. Obviously, software isn't a house but there are ways to paint yourself into a corner when building software.
A good example of this was a system I heard about where all dollar amounts were stored in 16 bit ints. They were smart enough not to use floats but didn't create/use a special money type or anything (YAGNI). But then, a potential customer wanted to use the system to sell big ticket items like airplanes and they lost out on a big contract.
A little bit of forethought can go a long way. It just needs to be balanced. The more experience you have the more likely your foresight will pay off and the less you need to blindly adhere to YAGNI.
|
|