Re: Java type-casting -- Q3
grz01 wrote:
OK, I then doubt you're too familiar with the principles of
"dont repeat yourself" and being a "lazy programmer".
http://en.wikipedia.org/wiki/Don%27t_repeat_yourself
http://blogoscoped.com/archive/2005-08-24-n14.html
Regardsless of programming language,
and in my experience, I think these are extremely
valuable principles.
But since they are probably also in the field
of "religious issues", I think I will not try
any further to convince you :)
They aren't religious issues. They're buzzwords for two of the toolshedful of
design and development principles. Turning them into religious issues is one
of the surest ways of ruining their utility.
"Don't repeat yourself" (DRY) isn't the same as "Don't ever, ever, ever repeat
yourself under pain of eternal Hell fire!"
Being a lazy programmer doesn't mean expending less energy than you need to.
These are principles that must be applied intelligently and in balance with
other principles of intelligent, competent programming. Just because you are
championing 'Pair' doesn't mean it was the right choice for Peter's scenarios,
nor that his decision not to implement 'Pair' was made in violation or
ignorance of the principles. The rhetorical device of labeling Peter
deficient (/ad hominem/ fallacy) because he disagreed with your point is
illogical and has failed.
What Peter described was neither repetition of code idioms nor expenditure of
excess energy, so I don't know why you picked those two principles in
particular. He pointed out that the simplistic nature of the proposed
'Pair<T,U>' class was insufficient for the needs he has encountered. That
means that the needs were unique and he was not repeating code. It also means
that he would have had to expend more effort to make 'Pair' suit his purpose,
so the principle of lazy programming that you endorsed pushed him away from
that choice.
Instead of attacking the person who disagreed with you, learn from his wisdom.
--
Lew