The example you cited of changing functionality (123,456 => 12,3456)
is a re-specification of the design or contract and probably shouldn't
be done, or at very least, would require a very clear notation in the
Yes, but shouldn't you have tests checking that your superclass didn't
change its specification? Shouldn't that be very important tests?
It would also logically lead to a maze of dark twisty tests, where every
module would start testing that substr counted from 0 not 1 and that *
really knew how to multipy two numbers.
No, because your module isn't providing substr or multiplication
functionality. It isn't subclassing the functionality of the Perl
runtime environment. But if you have a class that's subclassing a class
that provides number formatting, then your class is providing number
formatting. That that happens through inheritance isn't something the
users need to know (encapsulating of the implementation).
It's the same if you buy a Ford. You'd expect that Ford checks that the
tires stay on the wheels when going 100km/h, and don't assume that they
delegate that to Goodyear (or whatever brand they use). Goodyear does
its test, but Ford should do as well.
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>
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
Want more info? How to link or
or How to display code and escape characters
are good places to start.