Unit 6 Flashcards
What is ‘design by contract’?
Design by contract is the process of developing software based on the notion of contracts between objects, which are expressed as assertions.
(b2, p80)
What is an assertion?
An assertion is a statement that is either true or false.
(b2, p79)
What are the four main advantages to the DbC approach for adding assertions?
- Assertions provide accurate documentation for the implemented classes so that a programmer knows how to use the classes and what to expect from them.
- Provided they are executable, assertions are an important aid to testing, but without being an obstacle to efficiency.
- Assertions provide a way of controlling inheritance in which substitutability and redefinition of methods are allowed.
- Provided that the programming language has an exception mechanism that accords with the principles of DbC, assertions together with the exception-handling mechanism can be an important aid to developing mission-critical systems.
(b2, p79)
To what extent can DbC help with traceability, and hence be used to improve the quality of a software system?
DbC allows the development of a software system to be traced from requirements through to code.
(b2, p81)
What are the two basic ways in which classes relate to each other?
- Through associations
- Through generalisations
(b2, p85)
What three sets of items should be investigated when searching for possible postconditions for an operation?
- Instances of a class (objects) that have been created or deleted
- Instances of associations (links) that have been formed or broken
- Attributes that have been modified
(b2, p87)
What is an interaction diagram?
An interaction diagram is a UML diagram that shows the sequencing of messages in an interaction.
(glossary)
What is a sequence diagram?
A sequence diagram is a UML interaction diagram that focuses on the time-ordering of the messages.
(glossary)
What is a communication diagram?
A communication diagram is a UML interaction diagram that focuses on the structural aspect (instances and links) of an interaction.
(glossary)
What is GRASP?
GRASP stands for General Responsibility Assignment Software Patterns, and is a collections of patterns which may help the designer assign responsibilities in commonly recurring design scenarios.
(glossary)
What is GRASP Creator?
GRASP Creator is a pattern that provides guidance on which class should be responsible for creating new objects.
(glossary)
What is GRASP Expert?
GRASP Expert is a pattern that provides guidance on which class should be responsible for initialising or changing the state of an object.
(glossary)
What is a CRC card?
A CRC (class-responsibility-collaboration) card is a way of modelling how classes interact.
(b2, p108)
What are the three components of a CRC card?
- Class name
- Responsibilities of the class (what data it holds and what it can do)
- Collaborators of the class (other classes it interacts with)
(b2, p108)
What is the difference in emphasis between sequence diagrams and communication diagrams?
Sequence diagrams emphasise the flow of messages from object to object over time.
Communication diagrams emphasise the message traffic across links in a particular configuration of objects.
(b2 p114)