F5 considered harmful

While reading this publicized blog from Somasegar, in which he tells us that the famous "Edit & Continue" from VB 6 will work in VS 2005 with VB.NET *and also* with C#, I remembered something I read many years ago (I paraphrase because I can't remember yesterday mails, let alone an article I read in 198x):

One of the best lessons I learnt from my first boss was: "when your code doesn't behave as expected, don't use the debugger, think."

Debugging a thousand lines program going step by step is painfully counter-productive yet, for some reason, every body executes his code in Visual Studio hitting F5 and then steps through it until it blows at line 987... IMHO, it's better to hit Ctrl-F5 (which also runs faster), read the exception and the line number, look at the ceiling and ask "why?", because if you don't understand why a program does what it does, you can hardly solve the problem: F5 may help you to patch the line but it won't help you to understand the problem, F5 bloats your code with if's for what you think are "special cases". I won't lie: I use F5 almost every day: when I don't understand why, that is, when I have tried three times to solve the problem and I simply can't get it, but in truth, 80% of the time the problem surrenders to my Ctrl-F5 before I surrender to F5. As an aside, I get a better understandement of the code, and so do other people, because I've got less "special cases".

Published Tuesday, October 19, 2004 12:38 AM by Edgar Sánchez
Filed under:

Comments

# re: F5 considered harmful

Tuesday, October 19, 2004 1:14 AM by Addy Santo
People used to say the same thing about Intellisense. Bottom line - if it allows developers to be more productive, then it is a good thing. As with any tool, there will always be idiots who try to use it *instead* of thinking, but those people should be flipping hamburgers anyway so it doesn't really matter :)

# re: F5 considered harmful

Tuesday, October 19, 2004 1:34 AM by Edgar Sánchez
Hi Addy,

I don't think "debug by default" is in the same league as Intellisense. Intellisense saves you from memorizing exact spelling, order and type of parameters, and the like. So Intellisense is basically a superb cheat sheet (a good thing since school days ;-). F5 on the other hand tries to save you from thinking and understanding which most of the times is a dangerous thing *not* to do.

# re: F5 considered harmful

Tuesday, October 19, 2004 3:13 AM by SaberOne
Maybe it's just me, but systems tend to get more complex when they have to communicate with a lot of different services. Without logging or debugging it would be near impossible to see what's going on. Why? Because people don't have the ability to visualize every possible situation in their mind.
And I guess you should ALWAYS think about your code ;)

# re: F5 considered harmful

Tuesday, October 19, 2004 6:52 AM by Abby Bon
There's always one that just doesn't get it! E&C is fantastic.

# Debugger Debate

Tuesday, October 19, 2004 8:27 AM by TrackBack

# re: F5 considered harmful

Tuesday, October 19, 2004 8:27 AM by Chris McKenzie
My comments posted here:
http://weblogs.asp.net/taganov/archive/2004/10/19/244458.aspx

# re: F5 considered harmful

Tuesday, October 19, 2004 9:23 AM by Rogelio Morrell
Serio, Edgar, es muy necesario. Imaginate restart una aplicacion de 15 assemblies.
---------------------------
Really, is very necessary. Imagine restart debugging for an application with 15 assemblies.

# re: F5 considered harmful

Tuesday, October 19, 2004 10:14 AM by quaid
Yes, that's one viewpoint, but...
Please permit me to perform a febrile, childish dance of victory:

La la la dee da!
Edit & Continue!
Dum de dum de dum de dum
Will be supported in C#/VS2005!

Thankyou.

# re: F5 considered harmful

Monday, June 19, 2006 9:10 PM by rape stories
Your article is prety nice. It's a pity that i didn't see it more later.

# re: F5 considered harmful

Tuesday, June 20, 2006 7:30 AM by teen *** rape
Persone los pioneros non rabata. Great...

# re: F5 considered harmful

Friday, December 05, 2008 8:45 PM by Semil

<a href= spiritez.com ></a>

Leave a Comment

(required) 
(required) 
(optional)
(required)