Study your flashcards anywhere!

Download the official Cram app for free >

  • Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off

How to study your flashcards.

Right/Left arrow keys: Navigate between flashcards.right arrow keyleft arrow key

Up/Down arrow keys: Flip the card between the front and back.down keyup key

H key: Show hint (3rd side).h key

A key: Read text to speech.a key


Play button


Play button




Click to flip

22 Cards in this Set

  • Front
  • Back

Design by Contract (DbC)

- a way to ensure that a system performs its intended function is based on the real-world concept of a contract

- when an object sends a message to another objet, a form of constract exists

- the receiver is being asked to perform a service for the sender

- the sender is viewed as a client and that requests a service from the supplier (receiver)


- preconditions

- postconditions

- and invariants

role of assertions

they specify details of the requirements that cannot be represented graphically

- embody the contract between custmer and developer by stating what the customer wants, and hence what the developer must provide

- some of them can be included in the code

roles of contracts

- helps providing a traceable pathway from analysis, through design, to implementation, that shows how the assertions were developed and relates to the code directly to the requirements

correct software

if the implementaton of the software representing the client and supplier meets its contract with respect to its specification

advantages of DbC approachfor adding assertions

1. assertions provide accurate documentation

2. as they are executable, assertions are an important aid to testing, without being an obstacle to efficiency

3.provide a way of controlling inheritance in which substitutiability and redefinition of methods are allowed

4. assertions together with the exception-handling mechanism can be an important aid to developing mission - critical systems

static analysis tools

analyse the code to detect defects but do not execute the code


is the most effective static analysis tool at this time

- it will detect all syntax errors

critical systems

- their failure would have catastrophic consequences

- it is vital that such systems be as error-free as possible and so even the most expensive development of such systems to use formal methods,which are based on mathematical notations, logic and proof

safety-critical systems

its failure causes loss of life

business-critical systems

failure causes the loss of business

mission-critical system

failure to meet significant objectives

description of a contract

- description of the task, activity or operation

- the precondition

- the post condition

constraints on behaviour

- objects that are created and/or destroyed

- links between objcts that are created and/or destroyed

- attributes whose values are changed

use case realisation

the way of thinking the use cases to the classes that are going to carry them through

dynamic modelling

shows how the objects interact by sending messages to implement the required functionality

-it requires you to make some decisions about which classes have the responsibilities (operations) needed to carry out which parts of the overall use case

interaction diagrams

- are notations to help make and record decisions relating to the behaviour defined for a class

- objects are shown exchanging messages-

- sequence diagram

- communication diagram

- when you have completed a set of interaction diagrams, you will have built interface specifications for classes

sequence diagram

shows the flow of messages from object to object as time passes by

communication diagram

shows the objects and their links, the flow of messages as they pass along the links between objects

assigning responsibilities

- must be justified in terms of guiding design principles such as encapsulation, low coupling and high cohesion

- Craig Larman 2004 defined a collection of patterns based on these principles:

GRASP General Responsibility Assignment Software Patterns

GRASP Expert (Information expert)

- assign responsibility based on object properties

- the responsibility is assigned to the class that has the information necessary to fulfil that responsibility

- this information is represented by the properties of the object of the class

- use it whan you need to decide which of a number of interacting objects a responsibility should be assigned to.

- The pattern maximises encapsulation, as objects use their own information to fulfil a task

- enhances low coupling and high cohesion

GRASP Creator

- assign responsibilities for creating objects

- the responsibility for creating an instance of some class is assigned to the class that aggregates, maintains or records, or contains instances of the class of the newly created object, especially id the creator class provides the data required to initialise the newly created object

- use this pattern whenever you need to assign responsibilities for object creation.

- low coupling is maintained between the creator class owing to the existing associations that motivated its choice as the creator