by raganwald · 15y ago · 0 comments
A better question would be, there's tremendous deadline pressure, the company is in imminent danger of losing a giant deal if we don't have working code for some demo, and you have three features to implement by Monday afternoon. Do you write a new feature immediately, open a ticket for refactoring this loop and then write a new feature, or rehearse your explanation to the big boss that over the lifetime of the software, rewriting the code before adding a new feature was more important?
http://raganwald.posterous.com/javas-comb-over
Just kidding, but trying to make the point that "what do you think of this code" is a little obvious as an interview question.
In otherwords showing confidence, humility, communications, and that they have a clue about quality.
The point of code review is to catch monsters like this when they are written. If that doesn't happen, what's the point?
This code works and, as he says, was produced by a coder under time pressure. You show me a system and pretty much I'll show you a system that has poor (but working) code in it produced by a competent developer under pressure.
And code review is a useful process but it's no guarantee that issues will be caught any more than system testing or user acceptance testing.
And yet the world keeps on spinning and all is not lost.
I agree, you'd hope this was caught, but if someone gave that answer in an interview even aside from the tone, I'd wonder how much real world experience they had.
while( this.MyControl.TabPages.Count >0)
{
this.MyControl.TabPages.Remove ( this.MyControl.TabPages[0] );
}