in reply to "if" Considered Harmful in OO programming
What we have is a simple coding error that could have been tamed in other styles as well, such as adding a function to check for tags of certain types. In fact, the thought to make that a function would have been more readily obvious in a functional paradigm, at least I think so (i.e. short functions that build on other functions so everything works like magic).
Liberal use of objects can be a good thing, but using polymorphism or inheritance to defeat an if statement is suicide. Beer is good in small amounts. Objects are good in small amounts. Know your limitations.
<quote> This section has presented numerous rules for staying out of trouble with inheritance. The underlying message of all these rules is that inheritance tends to work against the primary technical imperative you have as a programmer, which is to manage complexity. For the sake of controlling complexity, you should maintain a heavy bias against inheritance. </quote>
100% Agreed! Thank you people for backing me up! I'd print this out and put it on my cube wall, though everyone here at Innotech would stone me for those beliefs. I'm already a black sheep though... (baaa!)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hmm...
by bwelch (Curate) on Sep 21, 2004 at 17:25 UTC | |
by pdcawley (Hermit) on Sep 26, 2004 at 21:46 UTC | |
by radiantmatrix (Parson) on Sep 23, 2004 at 15:40 UTC | |
by SpanishInquisition (Pilgrim) on Sep 23, 2004 at 17:42 UTC |