1. Debug Methodology

I've set up a debugNote() function whereby if debugMode = ON then the 
function will write some debug info to a text file. My question is 
this... would you have each function provide its own debut note? For 
instance...

-- METHOD ONE
-- each function provides its own debug note
function one()
    debugNote("Entered function one()")
-- do some stuff
    debugNote("Exiting function one()")
    return 1=1
end function

procedure one()
    junk = one()
end procedure

-- METHOD TWO
-- caller must provide debut note
function one()
-- do some stuff
    return 1=1
end function

procedure one()
    debugNote("Going to function one()")
    junk = one()
    debugNote("Returned from function one()")
end procedure

-- END EXAMPLES

new topic     » topic index » view message » categorize

2. Re: Debug Methodology

CK,

 Your second method is superior because it covers cases the first method
can't, for example the calling of a linked C function. It is also easier in
that the called function might have multiple exit points and you would need
debug notes for all of them even if you had no need to distinguish them.

This method also supports a top-down approch--if your debug notes indicate
that the called function is returning correctly, you need never code debug
notes in it.

-- Mike Nelson

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu