Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Why not refactor XXX into ZZZ...
Yes, but the point is to avoid refactoring existing code where possible.

The Long Story

My team has inherited a large codebase of resource libraries. Due to the man-years required to refactor this into something that fits the use model, the team is making use of the existing codebase. (Eventually, something may replace it, or we may move on to something completely different.)

This is a system to test real hardware, firmware, and software in multiple systems communicating with each other, the test controller, and other interested auxilliary systems. The core of the codebase is an "event loop" system that polls multiple remote systems, registers events to trigger at specific times, and registers signal handlers listening for certain kinds of responses. (Some issue with threads was apparently encountered at inception, so this is a polling system using RPC or somesuch.)

Our current aim is to write stand-alone tests for various components and features. The base class that all tests use is capable of handling nested tests, such that with a little forethought, all tests can be run concurrently in the "event loop" system. The base class registers all nested tests, and runs through all setup methods, then all initiate methods, then all complete methods, then all teardown methods. While the execution path is not threaded, multiple events on multiple systems can occur concurrently or simultaneously (depending on the nature of the events). Properly structured tests are written as modules, which can then be used (nested) in other tests, ad nauseum.

The point of my question was to discover a practical way to layer tests upon tests, with minimal rewriting of existing tests. Since everything is in a formal system with code reviews and releases, it is important not to go refactoring big swaths of code to add a minor bit of coverage to the suite of tests.

I've swept a lot of details under the rug, and while there is some leeway to change direction, we can't incur a lot of refactoring time. There is a moderate but growing list of test scripts, so any global refactoring decision should be made as soon as possible.

Ultimately, I think we'll have to refactor the big methods into smaller ones, and call into the parent(s) at a refined level to do only the bits needed, and not just rewrite a larger method (with considerable duplication). (I've probably left something out, but I'll stop here for now.)

-QM
--
Quantum Mechanics: The dreams stuff is made of


In reply to Re^4: Call Grandparent Method, Skipping Parent by QM
in thread Call Grandparent Method, Skipping Parent by QM

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-24 04:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found