debugging - Combatting debug code in release product -


i work in small startup development shop (3 developers), , pulled away working on fix mission critical bug or implement "absolutely critical" software feature - bug list re-prioritized on daily basis , seldom know "important" a few hours now.

because of this, have found becoming more , more wary of adding code can potentially go unchecked our qa department (read: person).

when implement new function, not knowing whether i'll called away @ time, try write return statement @ top make sure code never gets executed on release build.

the problem statements like:

public void newfunction() {     return; // put break point can use debugger step meat:      meat:     // ... more code } 

are in debug mode, visual studio smart enough know meat: never executed, can't use "set next statement" command meat:. same true wrapping code in compiler directives #if !debug.

instead, write things like:

public void newfunction() {     if("a"[0]=='a')         return; // put break point here      meat:     // ... more code } 

so if code accidentally slips release, no harm done, because it's not evaluated until run time, can use debugger step meat: no problem.

i don't leaving things unfinished, in crunch times don't have time shelve change sets or things properly. access unfinished features function outlines above via api aren't concern @ moment, don't see immediate harm in leaving them in software (but down line, can lead several wtf moments during maintenance - in "wtf function doesn't doing here?" because won't remember doing 6 months now).

considering (sadly) doing stuff on semi-regular basis, there standard practice issue? larger issue, there set of practices combat debug code in software releases in general?

assuming code in c#, can use [conditional] attribute exclude method calls in release configuration:

[conditional("debug")] public void newfunction (object something) {     // } 

this equivalent wrapping method , calls #if debug / #endif clauses.

any calls newfunction excluded compiler when debug symbol not defined. simplest way control solution , project configurations in visual studio. in debug configuration, debug symbol defined, opposed relase configuraiton.

note void calls can excluded because code doesn't depend on return values these methods.

however designed used tracing, logging etc. don't quite understand how plan leave methods unfinished yet still use them in debug versions. what's sense of calling them if don't work, or if do, why not include them in release?


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -