Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
You write: The problem arises when the super class number formatter is changed to have the comma every four digits, but the subclasses don't have tests for this and thus we're altering subclass behavior without testing it.

Well, I may be wrong, but it is my understanding that the subclasses trust the superclasses with respect to behaviour the subclasses don't define themselves. That is good, since the comma may have changed to four digits because the new protocol specification says so, and then all subclasses will have that changed automatically. I think that's a basic assumption of OO design.

That is also bad because the superclasses are responsible for all their subclasses' good behaviour, and the programmer must, when changing how the superclass works, keep in mind all the subclasses he may be breaking.

As projects grow large, that is both a blessing and a curse. The cure, well, is to keep strict documentation of what each class is supposed to do, and how. Which is also a pain in its own right.

My take on the question at hand is that tests should be subclassed so that the inherited behaviour of the superclass will be preserved on the test. That's how OO works, IMO. If the subclass isn't supposed to change in behaviour when its superclass changes, then it's got no business in being inherited on the first place.


In reply to You can't ever have the perfect classes, I guess... by cbraga
in thread Inheriting Tests and Other Test Design Issues by Ovid

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 making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-03-28 08:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found