Unit 6-Section 2 Flashcards
Dynamic modelling- from analysis to design
contract
object sends a message to another object
How contract comes into
- the client (caller) expects the supplier to perform the service correctly.
and - the supplier expects to be asked to perform only those services.
knows how to supply. - If either of these expectations is not met, the contract has been
broken.
what is a Pre-Condition in use case diagram?
requiring something from the client object,
which is of benefit to the supplier object.
What is a post-condition in the use case diagram?
requiring something from the supplier
object, which is of benefit to the client object. .
What are the Benefits from identifying roles in terms of clients and suppliers? ?
Enabling designers to specify the responsibilities of objects more
precisely;
−Allowing clearer software to be built, and, in turn,
−Leading to greater confidence in the correctness of the software.
What is Design by Contract (DbC) ?
is the process of
developing software based on contract between
objects, where in this process:
* Operations appropriate for each class
* Pre- and post-conditions are specified
Assertions?
are statements that are used for placing constraints on the
relationship between classes.
details of the requirements that cannot be represented
graphically.
Four main advantages to the DbC approach for adding
assertions?
- Assertions provide accurate documentation for the implemented
classes - Provided they are executable,
- Assertions provide a way of controlling inheritance
- provided the programming language has an exception
mechanism
How can DbC help to improve quality?
DbC complements many of the other tools:
*. Static analysis tools: that are used to analyse code to detect defects before
execution such as a compiler that finds all syntax errors.
*.Dynamic analysis tools: such as testing, this occupies 40% of total project
effort
critical system
are software systems
where failure may have catastrophic
consequences such as:
−Loss of life (safety-critical systems),
−Loss of business (business-critical systems) and
−Failure to meet significant objectives (mission
critical systems).
How to use develop a critical systems
Formal methods – based on mathematical notations, logic and proof.
−Analysis tools to make the systems as error-free as possible.
−Design by Contract where the most important feature of DbC is allowing the
development of a software system to be traced from requirements through to
code.
Contracts in real world
In business, contracts are specifications of the obligations of, and benefits to, the
parties involved in an agreement.
To weaken a precondition
means generalizing the situation in which a
service can be provided.
To strengthen a post-condition
means making the service that is
requested ‘better’ in terms of time, precision or some other measurable
item.
view of contract
The form of contract should be written as below:
A description of the task, activity or operation in question;
2.
3.
Precondition: a set of constraints that are assumed to be
true before you can start
Post-condition: a set of constraints that must be true
afterwards.