Writing Bug-Free C/D Code

Jascha Wetzel "[firstname]" at mainia.de
Wed Mar 21 05:16:08 PDT 2007


> "Use a debugger only as a last resort. Having to resort to a debugger
> means your programming methodologies have failed."

i strongly disagree with this statement.
you can do a lot more with a debugger than printing exception
stacktraces and finding uninitialized variables. it enables you to
conveniently watch your program work step by step, watch intermediate
values, etc. to check whether it does the right thing, not just on a
low, technical level.
no syntax or programming methodologies will prevent you from
implementing faulty algorithms, they'll just help you to not fall into
pits that are part of the details of a programming language.

Knud Soerensen wrote:
> This morning I stumbled over a on-line book named "Writing Bug-Free C Code"
> http://www.duckware.com/bugfreec/index.html 
> the gem of the book (chapter 4) is a way to implement an object model which
> provide better data hiding than C++ classes.
> 
> It also gives advise like:
> "Use a debugger only as a last resort. Having to resort to a debugger means
> your programming methodologies have failed."
> and 
> "When fixing a bug, fix the underlying problem or cause of the bug and not just the bug itself." 
> 
> D already have many feature which help the programmer make lesser
> bugs, but how can we make it even better ?
> 
> I think a good place to start is look at the last bugs reported by the
> users in released D programs, and consider if it is coursed by some
> fundamental flaw in D and what can be done to catch it earlier in 
> development.  
> 
> Maybe we need a place to report and discus this type of bugs.
> Is the newsgroup okay or would a bug-tracking system be a better option ?



More information about the Digitalmars-d mailing list