Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^5: Universal test flag

by ait (Friar)
on Jul 19, 2012 at 12:07 UTC ( #982619=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Universal test flag
in thread Universal test flag

Oh, you apparently think that I'm living off charity and only write abstract examples ;)

No sir, I don't make those assumptions ;-)

What I'm saying is that it's very different, for example, to code a well thought-out CPAN library, than working on a large system with a team of coders at different levels, with time and money constraints.

I think that your comments refer more to design than to the process of coding. Refactoring by very definition is a continuos and disciplined process after the fact, so your assumption above is actually wrong and must not be confused with good design. Good design is paramount, and that is not in discussion.

Furthermore, to actually be able to refactor you must first have a solid set of tests so when you actually refactor, you can guarantee the same functionality that should have been pinned down beforehand.


Comment on Re^5: Universal test flag
Re^6: Universal test flag
by zwon (Monsignor) on Jul 19, 2012 at 13:29 UTC
    to actually be able to refactor you must first have a solid set of tests

    And the exact problem with what you are trying to do is that it isn't solid. Suppose later you extract SMS sending code into a separate module, will your tests help you to find if you broke anything? No, because the code that may be broken by the change is being skipped in the test mode.

    So what I would do, is to write solid test, and refactor code to pass it.

      I think we are talking about two different things here. I understand what you are saying but this is not the case that the SMS code is inside the function and later factored out (in fact the SMS part was a made-up example to illustrate). I'm talking about the the case where the sub you are testing calls something else and you want to skip that, the same way you may skip tests in your test harness.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://982619]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2014-11-26 09:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (165 votes), past polls