C# is getting Edit and Continue in Visual Studio 2005

  • Thread starter Richard Blewett [DevelopMentor]
  • Start date
G

Guest

Wow thats nice. I have no idea why you have mixed feelings about it.

One of the most painful times to not have edit and continue is when you are
working on a large procedure to migrate a database. I really sucks when you
have to wait two hours until you reach the breakpoint again. LOL
 
C

clintonG

VB.SMUG has been deprecated :)

--
<%= Clinton Gallagher, "Twice the Results -- Half the Cost"
Architectural & e-Business Consulting -- Software Development
NET (e-mail address removed)
URL http://www.metromilwaukee.com/clintongallagher/


Richard Blewett said:
I've just seen on Eric Gunnerson's blog that C# is getting Edit and
Continue in Whidbey. That will please alot of people - although me, I have
mixed feelings about it ;-)
 
R

Richard Blewett [DevelopMentor]

OK, let me be clear that I *do* mean *mixed* feelings. E&C is a useful tool in some scenarios and can really help resolve things like getting the logic the wrong way round in an if, etc then you are debugging a problem. But I have been burned in the past in two ways by it.

1) Writing a bunch of fixes via edit and continue and then the debug session getting trashed so having to close VB and losing all my changes (I know its my fault but E&C has a siren call theat leads you down that path.

2) It is a dangerous tool in the hands of inexperenced developers in that they will keep hacking around in a function in the debugger until it gets the result they want. Whether the function as a result actually fits all test criteria or whether the code is structured in a maintainable form becomes a secondary (or not even considered) issue.

Its nice to get E&C but to be frankly I didn't miss it all that much - you only really miss it if it is one of the main features of how you write code, and from a C++ background primarily it never was for me (I know C++ had E&C from version 6 but frankly I think it sucked rocks compared to VB's version.). Test Driven Development to me is a much more powerful thing to have at your disposal - and maybe combined with E&C gives quite a good sweet spot in that if while making changes in a function you break something you'll know pretty quick.

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

Wow thats nice. I have no idea why you have mixed feelings about it.

One of the most painful times to not have edit and continue is when you are
working on a large procedure to migrate a database. I really sucks when you
have to wait two hours until you reach the breakpoint again. LOL
 
J

James Curran

Richard Blewett said:
1) Writing a bunch of fixes via edit and continue and then the debug
session getting trashed so having to close VB and losing all my changes (I
know its my fault but E&C has a siren call theat leads you down that path.

Well, I don't know which model C# will follow, but in VC++, E&C still
requires saving changes to disk before compiling & continuing execution.
2) It is a dangerous tool in the hands of inexperenced developers in that
they will keep hacking around in a function in the debugger until it gets
the result they want.

I don't see this as being a problem with E&C. Bad programmers will
write bad code. E&C helps (good & bad) programmers write code faster.
Therefore, E&C will help bad programmers to write bad code faster. But it
also helps good programmers write good code faster.

--
Truth,
James Curran
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
(note new day job!)
 
R

Richard Blewett [DevelopMentor]

The point I was making in 2 wasn't about *bad* programmers it was about *inexperienced* programmers. I don't think E&C teaches people good programming practice, although it is a very useful tool in the right hands.

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog
2) It is a dangerous tool in the hands of inexperenced developers in that
they will keep hacking around in a function in the debugger until it gets
the result they want.

I don't see this as being a problem with E&C. Bad programmers will
write bad code. E&C helps (good & bad) programmers write code faster.
Therefore, E&C will help bad programmers to write bad code faster. But it
also helps good programmers write good code faster.
 
G

Guest

Nearly any feature can be abused, or misused.

Richard Blewett said:
The point I was making in 2 wasn't about *bad* programmers it was about *inexperienced* programmers. I don't think E&C teaches people good programming practice, although it is a very useful tool in the right hands.

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

they will keep hacking around in a function in the debugger until it gets
the result they want.

I don't see this as being a problem with E&C. Bad programmers will
write bad code. E&C helps (good & bad) programmers write code faster.
Therefore, E&C will help bad programmers to write bad code faster. But it
also helps good programmers write good code faster.
 
D

Daniel O'Connell [C# MVP]

Richard Blewett said:
I've just seen on Eric Gunnerson's blog that C# is getting Edit and
Continue in Whidbey. That will please alot of people - although me, I have
mixed feelings about it ;-)

Ya, annoying, ain't it? :)
 
W

William Stacey [MVP]

I would be more curious in how they "figured out a way to do it". Did they
figure a cheap way to do it? If so, how in general?

--
William Stacey, MVP

Richard Blewett said:
I've just seen on Eric Gunnerson's blog that C# is getting Edit and
Continue in Whidbey. That will please alot of people - although me, I have
mixed feelings about it ;-)
 
D

David Levine

For the projects I work on it will be a godsend. It may take up to 10
minutes to compile, launch, and get back to where I was in the debugger when
I realized I needed to write ( someBool == true ) instead of ( someBool ==
false).

Like all tools, it can be abused - I don't find that to be a compelling
enough reason to not have the feature.
 
R

Richard Blewett [DevelopMentor]

I'm not saying I don't want it, in general I'm pleased - I just wasn't running around my house shouting "WAHOO!!!" when I heard because it also can have a downside that I've experienced directly

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<[email protected]>

For the projects I work on it will be a godsend. It may take up to 10
minutes to compile, launch, and get back to where I was in the debugger when
I realized I needed to write ( someBool == true ) instead of ( someBool ==
false).

Like all tools, it can be abused - I don't find that to be a compelling
enough reason to not have the feature.
 
D

David Levine

Now *there's* an image... :)

I agree about the dangers of E&C, but I think it likely that a programmer
that abuses E&C is likely to abuse other tools, not use the appropriate
tools, or use them incorrectly.
 
F

Frans Bouma [C# MVP]

Devin said:
Nearly any feature can be abused, or misused.

True, however you forget an important step. I assume you're a developer,
what else would you do reading this newsgroup ;). A developer sometimes has
to develop GUIs. Now, the best thing that can be done is to help the user as
much as possible so that the user makes the least amount of mistakes, which
results in the highest amount of succesful work. The point is thus to
disallow things which can result in failure, so you add checks, disable
controls on a given state etc. etc.

A developer is also a user, a user of a development environment and computer
language. No matter what, it's best that the developer makes the least
amounts of mistakes so the success rate is high. Giving a tool like E&C to
developers, makes it very easy to alter code inside the debugger until the
results are what is expected. This typical behavior is called 'Trial and
Error'.

What's way more efficient is to take a step back and actually analyse what
you've written, think through what the code should look like and compare that
with the code what was written. No trial and error, but structural software
engineering. People who develop planes don't have edit and continue, as they
arent able to alter a flying plane to fix a bug. Software engineers sometimes
seem to think that what they write is not that mission critical.

However this has been beaten to death for a loooooong time now. I can only
advice people what I've learned during the past 11 I do serious, professional
software development: learn to debug with analysis of the code written, the
algorithms to write. Debugging is hard, it's a science. However I firmly
believe that if a developer is forced to use a debugger like the gdb
commandline debugger, he/she will learn soon enough that stepping through 500
lines of code just to reach the lines where the error is originated is not
helping, and neither will altering code on the fly 'to see if this works'.

The only times I feel the need for E&C is when I need to use XPath queries
and I have an error in them. It's pure trial and error, and restarting the
app is then time consuming. It's however not the lack of E&C that makes it
time consuming. It's the lack of understanding of XPath on my side that makes
it time consuming. I also could have setup a set of simple tests to see which
query would do the trick for example, read more documentation etc. etc.
Without E&C you are forced to do that, but at the same time also learn things
along the way. With E&C you can hack around till it works and move on, with
the risk of running into the same error very likely.

I've written a piece about E&C some time ago and why it is bad. I can tell
you, being anti-E&C is not making you a lot of friends. Which I find rather
strange, as if people don't want to learn how to write proper software!
http://weblogs.asp.net/fbouma/archive/2003/08/01/22211.aspx

Frans.
 
F

Frans Bouma [C# MVP]

David said:
For the projects I work on it will be a godsend. It may take up to 10
minutes to compile, launch, and get back to where I was in the debugger
when I realized I needed to write ( someBool == true ) instead of (
someBool == false).

Like all tools, it can be abused - I don't find that to be a compelling
enough reason to not have the feature.

My question then to you is: if it takes 10 minutes to compile, why hasn't
anyone asked why there are so many projects in 1 solution and why you didn't
use TDD? I.e.: write the test first, then the implementation of your routine,
then run the test, see if the routine fails the test or not.

This is why E&C will not help you: the compile time of your solution will
still be 10 minutes. Step back and change! Chop up the solution into smaller
solutions. You don't work on 100 projects at teh same time, probably only 1.
This means that only 1 project has to be recompiled, or a couple. There are
build tools which do this for you. Command line builds with simple nmake
scripts are way faster than building in vs.net. Also with smaller solutions,
debugging/building is faster and running tests/altering code/ running tests
is also faster.

The fun thing is: with the TDD approach, you already have your test and you
keep it. So you can always check if what you altered failed some tests and
the TESTS are the representation of the specification you have to implement.
It might sound odd or old fashioned, but software development is not
something about ad-hoc code hammering. It's about crafting code to represent
functionality and data-structures. That takes time and skills and above all a
plan. Now, why is it that in the rest of the engineering business the plan is
the leading aspect of a project and everything is tested if it complies to
the plan, but in software land it appears to be something which can be
accomplished in a trial and error way inside a debugger 'till it works'. I
hope boeing never implements E&C on their products so their engineers can try
to 'fix' problems when the plane malfunctions at 30,000 feet.

Frans.
 
D

David Levine

You have a valid point but I disagree with your conclusion; IMO you present
a very one sided picture of how devs will use E&C. As everyone has already
pointed out, any tool can be misused - that still does not invalidate the
tool.

Developers are not equal - everyone has still different skill sets and
different levels of training and experience. A developer at a lower skill
set, or an inexperienced, lazy or incompetent developer might all use E&C
for fulltime trial-and-error, throw-code-at-it-until-it-works development,
but most developers don't use it that way and most don't work that way at
all. All good developers think about their design and implementation. Even
well-designed, structurally sound software can have off-by-one bugs, and
those are ideal candidates for E&C, and there are many other completely
valid uses of E&C.

IMO, where E&C shines is where a bug is painfully difficult and time
consuming to reproduce - once I am there I don't want to have to shutdown
the app to make an edit, especially when a simple minor edit will correct
the problem.

All modern debuggers provide the means of modifying the application data.
Conceptually this is no different then modifying the code that is being
executed - from the perspective of the the CPU code is data that is
interpreted as CPU instructions. By following your logic the editing of data
should also be disallowed and for the same reason (especially since many
applications are data driven) - the bug could just as likely be in the data
as in the code operating on the data.

BTW, trial-and-error is recognized as a technique that is part of the
scientific method - it is also known as experimentation. By itself it is not
evil, it is the misuse of the technique that is the problem. You even admit
to using it yourself for xpath queries!

Cheers,
 
D

David Levine

Frans Bouma said:
My question then to you is: if it takes 10 minutes to compile, why hasn't
anyone asked why there are so many projects in 1 solution and why you
didn't
use TDD? I.e.: write the test first, then the implementation of your
routine,
then run the test, see if the routine fails the test or not.

How on earth do you know if it had a unit test or not? You are also assuming
that a simple unit test is sufficient to test all aspects of an app - it
isn't. Further, a unit test is also more code that has its own bugs and
failures. And don't be mislead by the simple example I gave - it was
illustrative, not defnitive; there are many problems that occur that are
relatively trivial to diagnose and fix once the problem becomes known, but
will only occur in a given context that is extremely difficult to reproduce.

Further, don't make any assumptions about what has and has not been
discussed, tried, rejected, etc.
This is why E&C will not help you: the compile time of your solution will
still be 10 minutes. Step back and change! Chop up the solution into
smaller
solutions. You don't work on 100 projects at teh same time, probably only
1.

You have no idea of any of the systems I work on, the solutions and their
projects, or the environment they run in. If you want to try to dictate the
one-true-method of writing code, organizing projects, etc. then feel free to
try it, but don't be surprised if this arrogant attitude generates a lot of
backlash.
The fun thing is: with the TDD approach, you already have your test and
you
keep it. So you can always check if what you altered failed some tests and
the TESTS are the representation of the specification you have to
implement.

Yes, we know. We use it as *one* of our tools.
It might sound odd or old fashioned, but software development is not
something about ad-hoc code hammering. It's about crafting code to
represent
functionality and data-structures. That takes time and skills and above
all a
plan. Now, why is it that in the rest of the engineering business the plan
is
the leading aspect of a project and everything is tested if it complies to
the plan, but in software land it appears to be something which can be
accomplished in a trial and error way inside a debugger 'till it works'. I
hope boeing never implements E&C on their products so their engineers can
try
to 'fix' problems when the plane malfunctions at 30,000 feet.

I see....I've been architecting, designing and implementing systems for a
long time myself, all the way from circuit boards to panels to motor control
centers and more; and for more than the past decade, to writing device
drivers and application software. I should have asked you how to do it a
long time ago....I obviously have no clue what constitutes good engineering
practices.

You have a hectoring, accusatory style that is very offputting, you should
tone it down a notch.
 
F

Frans Bouma [C# MVP]

David said:
How on earth do you know if it had a unit test or not? You are also
assuming that a simple unit test is sufficient to test all aspects of an
app - it isn't.

It isn't? Ok, gui stuff aside, the rest can and should be unit-tested. That
aside, your 10minute compile problem is not going away with E&C. You really
should address that.
Further, a unit test is also more code that has its own
bugs and failures. And don't be mislead by the simple example I gave - it
was illustrative, not defnitive; there are many problems that occur that
are relatively trivial to diagnose and fix once the problem becomes known,
but will only occur in a given context that is extremely difficult to
reproduce.

Weird, I never run into these and believe me, the code I write has a lot of
layers on top of eachother.
Further, don't make any assumptions about what has and has not been
discussed, tried, rejected, etc.

errr, I was trying to help. Apparently you don't want to be helped. You
describe a problem, that you need a debugger feature to circumvent a 10minute
compile problem. I try to help you with that problem and I get "dont make
assumptions this" and "how on earth do you know that". I'm sorry David, but
if you don't want me to help you, that's fine, just say so and I can spend my
time elsewhere.
You have no idea of any of the systems I work on, the solutions and their
projects, or the environment they run in. If you want to try to dictate the
one-true-method of writing code, organizing projects, etc. then feel free
to try it, but don't be surprised if this arrogant attitude generates a lot
of backlash.

WTF?! Who's arrogant here!?

I was just trying to explain that there might be a solution to your problem.
And what do I get? I'm arrogant. David: good luck finding a solution to your
problem, I truly hope someone else who tries to help you is not slapped in
the face with "your arrogant attitude". Geezz...

Frans.
 
N

Nick Malik

My question then to you is: if it takes 10 minutes to compile, why hasn't
anyone asked why there are so many projects in 1 solution and why you didn't
use TDD? I.e.: write the test first, then the implementation of your routine,
then run the test, see if the routine fails the test or not.

I'm sure you were trying to be helpful Frans, and I agree with many of your
points, if not all of them. However, your message is coming across as
patronizing and pedantic.

To whit, count the number of times that your message includes the word
'you', including the implicit 'you' but excluding 'your'.
This is why E&C will not help you: the compile time of your solution will
still be 10 minutes. Step back and change! Chop up the solution into smaller
solutions. You don't work on 100 projects at teh same time, probably only 1.
This means that only 1 project has to be recompiled, or a couple. There are
build tools which do this for you. Command line builds with simple nmake
scripts are way faster than building in vs.net. Also with smaller solutions,
debugging/building is faster and running tests/altering code/ running tests
is also faster.

The fun thing is: with the TDD approach, you already have your test and you
keep it. So you can always check if what you altered failed some tests and
the TESTS are the representation of the specification you have to implement.

Respectfully, once again, I agree with many of your points. In my TDD work,
I've found that I need E&C far less. However, I agree with David that I
find it handy. For example, let's say I write my test and the write my
code, and run my test. Every now and then, it fails. I place a breakpoint
in the unit test code just before the call that I suspect is breaking and
run again. The debugger stops and I enter my code. I find my logic error,
fix it, continue, and the test passes.

I had made a mistake. That's all. So I'm human... sue me.

E&C will help those of us who type quickly, program professionally, use
agile methods, and need to get it done.

It will also help inexperienced programmers do a poor job. So what. I'm
way past trying to save people from their own mistakes.

To me, programming is an art. Anything that removes restrictions on the
canvas is welcome, AFAIAC. I do abstract. Some folks paint by numbers.
The world is big enough for both.

On the other hand, while I agree with your points, I must agree also with
David that your tone, in this particular message, is condescending at best.

--- Nick
 
D

David Levine

It isn't? Ok, gui stuff aside, the rest can and should be unit-tested.

Unit tests are all well and good, but they do not solve all problems, and
there are many types of testing that unit testing does not begin to address.
Sometimes all that the unit test does is validate your own misconceptions
about the system. There are integration tests and systems test that need to
be performed and these cannot be performed in isolation.

There are also tests that require a different environment then is present
during the unit test, and duplicating this environment is extremely
difficult. And just so you know, we have hundreds of unit tests built into
the project, and they are all run as part of our automated build process.

And to your original complaint...yes, the team got together and discussed
the situation and we decided that it wasn't worth the downside to break up
the solution into a number of smaller solutions; we decided to live with the
long edit/compile/debug cycles and we would look at doing it differently on
the next project. There are problems when you break up a big solution into
numerous small solutions.

In addition, simply doing a compile doesn't take all that long when all that
changes is one project - anywhere from 2 minutes for a minor edit (such as
an E&C would do) to 10-15 minutes, depending on what needs to be built. It
is usually the time it takes to log in to the server, download the latest
bits from the server, download the project that was open, and get to the
point in the session where the problem occurred, that consumes the majority
of the time.
That
aside, your 10minute compile problem is not going away with E&C. You
really
should address that.

You keep throwing the term "you" around - that makes it personal, and for no
good reason. You assumed that the 10 minutes is solely because of the
compile time - I never said it was solely due to compiling. And you are also
assuming that this was "the" problem that I thought E&C would fix. All I
said it would help with that particular irritation.
Weird, I never run into these and believe me, the code I write has a lot
of
layers on top of eachother.

Then you are fortunate.

One example: we do a lot of complex installation code out of custom actions.
The environment that the code is executing in at that time is very different
then the environment that is present under a debugger or out of the
application. Application base paths are different, the appdomain is
configured per the MSI host, and oh-by-the-way, if you are doing an
uninstall/install (otherwise known as an upgrade) the MSI host does not
unload the appdomain used for the uninstall-time custom action before
calling the install-time custom action. This means that assemblies do not
get unloaded, types do not get unloaded, etc. which completely changes the
operating environment of the code. When we write a unit test all it does is
validate the routine as per the environment that exists at the time the unit
test is run, which may be completely different than the environment it is in
at the time the MSI is installed. And this is just one example where a
simple unit test does not fully test a routine.

Unit tests are great when the functionality is entirely self-contained, and
IMO its usefullness diminishes as the amount of interaction with other
components of the system increases. It also decreases in usefulness as the
complexity of the configuration, setup, or complexity of the mock objects
increases. All code has bugs, including the test code. At some point the
complexity of the test negates the usefulness of the results as the
reliability of the result degrades.

There are other examples where unit tests aren't useful.
errr, I was trying to help. Apparently you don't want to be helped. You
describe a problem, that you need a debugger feature to circumvent a
10minute
compile problem. I try to help you with that problem and I get "dont make
assumptions this" and "how on earth do you know that".

Um, errr, I'm sure you really believe you mean well, but it comes across as
condescending and nasty.
I'm sorry David, but
if you don't want me to help you, that's fine, just say so and I can spend
my
time elsewhere.

I'm sure you have something of value to contribute but the way you word
things and the approach you take is needlessly confrontational. I've had
many discussions up here and I've never had this experience with anyone
else.
WTF?! Who's arrogant here!?

You're posts here are. You made an enormous number of assumptions about the
solution, the projects, why it took 10 minutes to get back to a particular
point in a debugging session, if it had unit tests, and the environment it
was running in, my background, and engineering practices in general. You
then compounded this by making additional assumptions about the real cause
of the problem, it's solution, and its implementation. You then worded your
message in such a way that it was imperative, accusatory, superior, and
self-righteous (and note that I am categorizing what you write, not you
personally).

I not only support TDD and unit testing, I am doing a presentation on it to
my company! Yet you have a way of expressing yourself that makes me want to
disagree with your statements even when I agree with them. As I said
earlier, tone it down a notch.

Also, the analogy you used about how Boeing should not use E&C on planes is
flawed. There are a lot of dead test pilots who probably wished the plane
*did* have E&C (or pray&land). Upfront engineering minimizes flaws but it
does not eliminate them.
 
J

James Curran

Frans said:
My question then to you is: if it takes 10 minutes to compile,

He never said he had a 10 minute compile. His actual quote was :
"10 minutes to compile, launch, and get back to where I was"

I can easily imagine a 1 minute compile followed by a 9 minute setup to get
back to the situation of the error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top