Re: Using refactoring to make code more testable Re: [refactoring] Using refactoring to make code more testable

Richard <[email protected]>
Newsgroups gmane.comp.programming.refactoring
Organization multi-cellular, biological
Message-ID <[email protected]>
In article <1932321348-1255280632-cardhu_decombobulator_blackberry.rim.net-1918218162-@bda056.bisx.prod.on.blackberry>,
    [email protected], [email protected]  writes:

> My main task is to get the code covered.  [...]

To what end?

The three rules of programming apply:

1. Don't do it.
2. Don't do it again.
3. When all else fails, break rule 1.

In this context:

Don't write tests just for the sake of writing tests, particularly on
legacy code.  The changes you need to make to legacy code in order to
make it testable can just as likely introduce defects as they will
make the code testable.

If you have defects to fix in that legacy code, then do traditional
debugging to find the location of the fault and then do a minimal
amount of decoupling around the fault so you can write a failing test,
fix the fault and get a passing test.  Leave the rest alone.
-- 
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
 <http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

      Legalize Adulthood! <http://legalizeadulthood.wordpress.com>


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/refactoring/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/refactoring/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[email protected] 
    mailto:[email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.