5
paedub
6y

I once had to implement a program to process CSV files. One line would be one order, so I wrote a class with a static factory method (Java) instead of an ordinary constructor, because I needed to throw exceptions if something with the line was wrong (which now and then was the case: invalid product IDs, missing fields and the like). After I committed my changes (CVS was still common in those days), a coworker (let's call him Max) asked me what the hell I was doing there. He expected me to replace the code (perfectly working, by the way) with either an ordinary constructor or by implementing "the factory pattern properly". His rationale: "We don't have those kinds of things in our code base!" So I let him argue a bit, not finding any well substantiated reason for me to "fix" the code. So Max wanted to team up with another developer in our office (let's call him Rick), explained the "issue" to him. I just sat there and enjoyed, knowing that Rick would not really care. But as soon as Rick understood what I did, he walked over to the book shelf, picked "Effective Java" from it, opened the book at chapter 1 and said to Max: "Look, Josh Bloch suggests doing it exactly that way for the problem at hand!" Max kept on arguing for a while, because his "rationale" (see above) was not affected by the fact that the code was actually good. It just didn't appear in our code base before.

Comments
Add Comment