Re: Coding guidelines for debugging improvement
Russell Gold <[email protected]>
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Message-ID | <[email protected]> |
No, please don't do this. It diminishes readability of the code and complicates refactoring. If you want to set a breakpoint, go ahead and defactor the code temporarily, but put it back when done. Ideally, with a test-driven-development approach, you shouldn't be spending all that much time in the debugger anyway. On Apr 4, 2008, at 9:05 AM, Wolfgang Fahl wrote: > Dear httpunit developers, > > may I suggest some coding guideline improvements to make debugging > easier? To set breakpoints it's necessary that the statements need > to be on separate lines. > > 1. Avoid use of ? operator > instead of > return a ? b:c > please do > result=undefined > if (a) > result=b; > else > result=c; > return result > > 2. Assign before return if intermediate results could > be interesting or problematic (e.g. null) > > instead of > return f(g(h(i(j(param))))) > > jr=j(param) > ir=i(jr) > hr=h(ir) > gr=g(hr) > fr=f(gr) > return f; > > 3. Multiple lines for interesting statements > so instead of: > for ( int i = 0; i < controls . length ; i++) controls > [i].claimRequiredValues( list ); > for ( int i = 0; i < controls . length ; i++) controls > [i].claimUniqueValue( list ); > for ( int i = 0; i < controls . length ; i++) controls > [i].claimValue( list ); > if (!list.isEmpty()) throw new > UnusedParameterValueException( _name , (String) list.get(0) ); > FormControl[] controls = getControls(); > for ( int i = 0; i < controls . length ; i++) > controls [i].claimRequiredValues( list ); > for ( int i = 0; i < controls . length ; i++) > controls [i].claimUniqueValue( list ); > for ( int i = 0; i < controls . length ; i++) > controls [i].claimValue( list ); > if (!list.isEmpty()) throw > new UnusedParameterValueException( _name , (String) > list.get(0) ); > > > > Thank you > > Yours > Wolfgang > > BITPlan - smart solutions > Pater-Delp-Str. 1, D-47877 Willich Schiefbahn > Tel. +49 1805 - BITPLAN / +49 1805 248 752, Fax +49 2154 811-481 > Web: http://www.bitplan.de > bitplan GmbH, Willich - HRB 6820 Krefeld, VAT-ID: 10258040548, > Geschäftsführer: Wolfgang Fahl > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace_______________________________________________ > Httpunit-develop mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/httpunit-develop ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ Httpunit-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/httpunit-develop