P is for Practical | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
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 upgrade documentation. 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. Abigail In reply to Re: Inheriting Tests and Other Test Design Issues
by Abigail-II
|
|