2009/8/13 Sebastien Lelong <[email protected]>:
>
> I'm not a big fan about putting such debug code into "production" code,
> since it's kind of polluting code's readability (debug code can be prolific
> and invade prod code...). There's no clean solution I guess (maybe using
> diff/patch ?), but maybe we should normalize the way it's done (naming
> convention for debugging constant, ...) in order to control this contagious
> code...
>
> What's your opinion on this, guys ?
>
First of all, I agree that I am not a fan of debug code laying around
either. And for sample code, I concider it unacceptable (and just keep
my fingers crossed I did not leave any in mine ;)
Basicly, libraries should work properly and also be (efficient)
maintainable. That is why you need the code to be readable. And that
is why we could leave debug code in when you expect to use it again.

Let's take the i2c slave code as an example. I removed two bugs in the
last few months (after the initial debug cycle and first application)
and expect there are still a few that will surface in the next year.
So that is why the debug code is still there (and could be forgotten).

As for style - it would be a good idea to use debug_ prefix for all
debug-related variables (that is, the one's that enable code or
influence behaviour in a way that is not usefull in normal
applications and the one's that provide information on the interal
processing). In addition to this, debug-code could be commented out.
It would just be to much hassle to make each configuration optional.
And this would give extra lines of code that reduced readablitiy. For
this reason, adding a comments like -- debug and --/debug would not be
a good idea IMO.

Joep

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to