Rationale

This chapter looks at system design from a software engineering perspective. In particular, it raises the problem of validation. How may we establish that software is reliable, and to what extent can our experience with validating ordinary software be generalized to an object-oriented approach? Also, a framework for testing object-oriented software is introduced. Our framework allows for employing the notion of invariance as a guideline for the design of test cases. This chapter further presents an experimental suit of metrics for establishing the complexity of object models. These metrics may provide a starting point for further research and empirical validation. At the end of this chapter, we will make up the balance and reflect on the possible contribution of formal methods.

Hints

Testing is a well-established discipline of software engineering. A small sorting example is included to explain some of the notions involved in structural testing. For students to appreciate the role of invariance in the framework proposed in this chapter, it is important to discuss the notions of state and state transitions and to show how we may employ invariance to abstract from actual state modifications. The discussion concerning the contribution of formal methods may be seen as a forward reference to the treatment of formal aspects in part III.

Further reading

There is a massive amount of literature on software validation and testing. A standard text is  [Myers]. As research papers, I recommend  [Doong90] and  [Smith92]. For a further study of the Law of Demeter look at  [LH89].

Project assignments

As subjects for writing a paper you may think of for example, those mentioned in  [Doong90] and  [Smith92]. As practical work, a possible assignment may be to for one of the programs suggested in appendix F. Also, you may think of based on the metrics discussed in section metrics.

Comments

Actual practice, and certainly in academia, shows that testing is an easily overlooked aspect. The most viable approach, to my mind, is one that is closely related to the notion of runtime consistency and hence involves dynamically monitoring the restrictions imposed by a contract. Contracts provide a means to combine a formal approach with pragmatic considerations of empirical validation.