Originally posted by Michael Morris:
Here is my thinking on the matter. I know that the provided source has been implemented and shown to work. Adding methods (or even adding code to unimplemented methods like lock and unlock) could introduce bugs into a known working class. [...]
Hmmm, I don't think this is a viable viewpoint. Think of the little classes, patches and kludges a software system would accumulate during its lifetime if it were maintained by these standards. Believe me, it's typically bad enough as it is
In an ideal world, Data would ship with a DataTest
JUnit test harness or similar. The test harness would fully test Data's contract with the outside world, and as long as your modifications satisfied the test harness you could be 99.9% confident that you're fine. This is actually one of the key mechanisms behind
Extreme Programming and its aggressive use of
refactoring.
Your concerns
are justified, and in my own experience JUnit has helped me spot bugs in interface implementations that had some subtle deviations from expected semantics. But that wasn't the
SCJD assignment, so I digress...
Apart from the fact that Data is an unfinished product, as argued by Adam, I don't think this point of view is a viable one in software development.
- Peter