|The World According to Nick|
|My take on Software, Technology, Politics, and anything else I feel like talking about.|
Tuesday, September 14, 2004
Warning: Geek Alert! Some coworkers of mine have been telling me stories now that I'm leaving, of the guy who used to sit where I do now. Mostly they've been doing this in an effort to show me the kinds of stories they'll make up about me once I'm gone (4 days and counting!). Anyway, the guys who used to sit where I do (who will remain nameless) apparently considered himself to be somewhat of a .NET Guru. However, then they shared with me a method which he used extensively to iterate through a collection which I will share with you now. If I ever see you write this code... I swear I will bring severe harm unto you.
I can understand why he doesn't work here any more. From my understanding, he left just before getting canned.
Update: A certain Miss Macy has asked for a description as to why this is bad. More than that, she has requested it to be understood by non-geeks (which may be asking for a lot). So... here is the short version (cause I don't wanna bore you with the long version).
First of all, there are programming constructs meant just for this purpose... known as the for loop and the foreach loop which are readily identifiable as used for iteration through a collection of things (thus making for very readable code):
Now then... doesn't that look so much nicer? Not only that, but the bad version above performs terribly. When the exception is thrown at the end of the "loop", the .NET runtime has to do a stack unwind which will take a couple seconds... that from a loop that should normally take a fraction of that depending on the size of the collection.
So it's not standard, it's less readable, and it performs like shit. All in all, it's just a bad way to do things.
Can you please explain why for your readers that aren't able to read teckie code & know what it means?Post a Comment
Home: Wauwatosa, WI, United States
I'm a Software Consultant in the Milwaukee area. Among various geeky pursuits, I'm also an amateur triathlete, and enjoy rock climbing. I also like to think I'm a political pundit.
View My Profile
Previous PostsThe Real Cost of Immigration
Monkey Crime Wave
Did You Remember?
Undisclosed Sources II
How Do You Convince Voters?
Food Service Rants
Goodbye Indian Larry
Personal LinksCarnival of the Badger
The Coding Monkey
Blog Critics Reviews
Design By maystar