Saturday, 26 March 2011

Brace Yourself

==========
Code Complete (Steve McConnell)
- Highlight Loc. 24021-30  | Added on Wednesday, February 23, 2011, 07:14 AM

After I published the first edition of this book, Hank, one of the programmers who reviewed the manuscript, said "I was surprised that you didn't argue more strongly in favor of a brace style that looks like this: for ( ...)    {    } "I was surprised that you even included the brace style that looked like this: for ( ...) { } "I thought that, with both Tony and me arguing for the first style, you'd prefer that." I responded, "You mean you were arguing for the first style, and Tony was arguing for the second style, don't you? Tony argued for the second style, not the first." Hank responded, "That's funny. The last project Tony and I worked on together, I preferred style #2, and Tony preferred style #1. We spent the whole project arguing about which style was best. I guess we talked one another into preferring each other's styles!"
==========

I was forced to switch brace style once. It was a valuable lesson in egoless programming. At the time I found it really painful. That was the bite of ego. Now I look at the old brace style I used and think it was stupid. But I would switch back if a project mandated it.

No comments:

Post a Comment