Re: Question on vector at()
On Mar 17, 7:55 pm, Ian Collins <ian-n...@hotmail.com> wrote:
Juha Nieminen wrote:
If I had to develop C++ programs without any kind of
debugger, it would be a real pain. Each small mistake, each
small typo, would require a long and laborious task of
manually adding debug prints to try to binary-search the
location of the error... Horrible.
There is a school of thought that I am becoming more aligned
with as my TDD skills improve that says using a debugger on
new code is a sign flaws in your development process.
I try avoid the debugger wherever possible, it simply slows me
down. Better to make a small change, run the tests. If a
test fails, revert the change and do it again another way.
Debugging with a debugger is one of those intense processes
that can suck up a lot of time before you realise ad it
disrupts the development flow.
I don't think you really mean it that way, but it sounds like
you're suggesting making stabs in the dark.
I think the important point is to understand what you are going
to write before writing it. I've seen a lot of second rate
programmers using the debugger to try to understand what they've
just written. That's wrong, and never gives good results. But
just writing random code, and then making random changes until
it passes the test suite isn't any better. The only general
rule that works is think first, then act. Don't write a single
line of code without knowing why---what the purpose of that line
is, what the state of the program is before the line is
executed, and what it will be after, etc.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34