Object Specification Moving towards a more precise specification of software.

Slides:



Advertisements
Similar presentations
The Software Lifecycle. Example Problem: Update a Checkbook Write a program that allows the user to enter a starting balance, a transaction type, D or.
Advertisements

Withdrawal Transaction Use Case Primary Actor: Customer Pre-conditions: The customer must have a valid ATM card and PIN. Post-conditions: The customer.
© 2010 Bennett, McRobb and Farmer1 Use Case Description Supplementary material to support Bennett, McRobb and Farmer: Object Oriented Systems Analysis.
Describing Process Specifications and Structured Decisions Systems Analysis and Design, 7e Kendall & Kendall 9 © 2008 Pearson Prentice Hall.
Programming Logic and Design Fourth Edition, Introductory
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Information System Engineering
ISBN Chapter 3 Describing Syntax and Semantics.
ITEC113 Algorithms and Programming Techniques
Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall Process Specifications and Structured Decisions Systems Analysis and Design, 8e Kendall.
1 Specifying Object Interfaces. 2 Major tasks in this stage: --are there any missing attributes or operations? --how can we reduce coupling, make interface.
Revision Session 3 Adding the detail and design for re-use.
© 2005 Prentice Hall4-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
Computer Science 1620 Programming & Problem Solving.
Control Structures: Getting Started Sequence and Selection also arithmetic operators, data types, logical operators.
University of Toronto Department of Computer Science © Castro, Mylopoulos and Easterbrook Lecture 12: Modelling Business Rules & Processes Ü Review.
September 2002 R McFadyen1 Domain Model Use Case Model text diagram SSD System operation contracts Design Model Figure 13.3.
© Bennett, McRobb and Farmer Specifying Operations Based on Chapter 10 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and Design.
Describing Syntax and Semantics
Programming Fundamentals (750113) Ch1. Problem Solving
Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 1 Object-Oriented Analysis and Design - CDT309 Period 4, Spring 2008 More on use cases System sequence.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
® IBM Software Group © 2006 IBM Corporation Writing Good Use Cases Module 4: Detailing a Use Case.
State Diagrams / System Sequence Diagrams (SSDs)
1 CMPT 275 Software Engineering Requirements Analysis Phase Requirements Analysis Activity (Identifying Objects, Scenarios) Janice Regan,
From Use Cases to Test Cases 1. A Tester’s Perspective  Without use cases testers will approach the system to be tested as a “black box”. “What, exactly,
1COM6030 Systems Analysis and Design © University of Sheffield 2005 COM 6030 Software Analysis and Design Lecture 10 – Classes and operations Dr Richard.
Describing Process Specifications and Structured Decisions Systems Analysis and Design, 7e Kendall & Kendall 9 © 2008 Pearson Prentice Hall.
© 2010 Bennett, McRobb and Farmer1 Specifying Operations Based on Chapter 10 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and Design.
WXGC6102: Object-Oriented Techniques Specifying Operations References: Chapter 10 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and Design.
By the end of this session you should be able to...
111 Protocols CS 4311 Wirfs Brock et al., Designing Object-Oriented Software, Prentice Hall, (Chapter 8) Meyer, B., Applying design by contract,
Low-Level Detailed Design SAD (Soft Arch Design) Mid-level Detailed Design Low-Level Detailed Design Design Finalization Design Document.
Originated by K.Ingram, J.Westlake.Edited by N.A.Shulver Use Case Scripts What is a Use Case Script? The text to describe a particular Use Case interaction.
UML-1 3. Capturing Requirements and Use Case Model.
UML-1 8. Capturing Requirements and Use Case Model.
4. The process specification (プロセス仕様) You will learn: (次の内容を学び) The concept of process specification (プロセス 仕様の概念) Notations for process specification (プロセス.
9-1 © Prentice Hall, 2007 Chapter 9: Analysis Classes Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey.
1 A Student Guide to Object- Oriented Development Chapter 6 Identifying Functionality.
System sequence diagrams
Staffordshire UNIVERSITY School of Computing Version Jan 08 original by K.Ingram & J.Westlake1 Use Case Scripts The text to describe a particular Use Case.
Week 3: Requirement Analysis & specification
Protocols Software Engineering II Wirfs Brock et al, Designing Object-Oriented Software, Prentice Hall, Mitchell, R., and McKim, Design by Contract,
Introduction to C Programming CE Lecture 5 Program Design in C.
7-1 © Prentice Hall, 2007 Topic 7: Analysis Classes Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey.
1 Program Development  The creation of software involves four basic activities: establishing the requirements creating a design implementing the code.
Chapter 1 Data Abstraction: The Walls CS Data Structures Mehmet H Gunes Modified from authors’ slides.
1 Introduction 1. Why Data Structures? 2. What AreData Structure? 3. Phases of Software Development 4. Precondition and Postcondition 5. Examples.
Copyright © 2011 Pearson Education Process Specifications and Structured Decisions Systems Analysis and Design, 8e Kendall & Kendall Global Edition 9.
1 Software Engineering: A Practitioner’s Approach, 6/e Chapter 11b: Component-Level Design Software Engineering: A Practitioner’s Approach, 6/e Chapter.
Testing It is much better to have a plan when testing your programs than it is to just randomly try values in a haphazard fashion. Testing Strategies:
1 Object Oriented Analysis and Design System Events & Contracts.
 Problem Analysis  Coding  Debugging  Testing.
Collision Theory and Logic
Analysis Classes Unit 5.
Abstract Data Type.
CMPE 280 Web UI Design and Development August 29 Class Meeting
DDC 2423 DATA STRUCTURE Main text:
Lesson #6 Modular Programming and Functions.
Collision Theory and Logic
Lesson #6 Modular Programming and Functions.
Specifications What? Not how!.
Algorithm and Ambiguity
Lesson #6 Modular Programming and Functions.
Specifying Object Interfaces
Java Programming Loops
Algorithm and Ambiguity
Protocols CS 4311 Wirfs Brock et al., Designing Object-Oriented Software, Prentice Hall, (Chapter 8) Meyer, B., Applying design by contract, Computer,
Lesson #6 Modular Programming and Functions.
Lecture 7 Algorithm Design & Implementation. All problems can be solved by employing any one of the following building blocks or their combinations 1.
Presentation transcript:

Object Specification Moving towards a more precise specification of software

Sequence (object interaction) diagrams Provide detail on the interaction between objects and the division of responsibility between objects- which classes hold which operations. When this is clear we can then look at providing more detail on significant (or more complex) operations.

Operation specification describes the detailed behaviour of the system. adds detail and precision so that user can check if requirements are met. Provides more detail for software design and helps in coding.

Example : Black box specification ‘Contract’ describes the external interface of an object and its signature. We know what goes in We know what comes out We know what the message does We don’t know how it does it. Balance Getaccountbalance

Contracts Intent or purpose of the operation Operation signature : parameters and return type Description of the logic Other operations called Events transmitted to other objects Response to exceptions

Delay flight alters the flight duration by the number of minutes specified. Get arrival time returns the time of arrival. Why do we need to be specific here? Examples from IBM Rational class diagrams

Non-algorithmic (declarative) Approaches Describe the logic of the operation as a black box. Show Operation Signatures or message protocols useful where a structured decision has to be made- the description is used to determine the conditions that determine the outcome. E.g. decision tables, pre and post conditions, OCL (Object Constraint Language )

Decision Tables A decision table is a matrix that shows the conditions under which a decision is made, the actions which can result and how the two are related. Steps in Drawing a Decision Table 1.List all conditions 2.List all possible actions 3.Fill in true/false values 4.Assign actions 5.Ensure all possibilities have been covered. These are useful for situations where there are many outcomes depending on various combinations of input conditions.

Decision Table example – register student on water safety RULE 1RULE 2RULE 3 Conditions Has student the prerequisite qualification? YNYN Is student old enough?YYNN Action Register Studentx Register on prerequisite (if qualified and old enough) xx Repeat or put on endurance training x

Decision Table example – can player get out of jail? RULE 1RULE 2RULE 3RULE 4 Conditions Has player get out of jail free card? YNNN Have they had 3 turns?NYNN Have they paid £50?NNYN Action Let outxxx Keep in Jailx

Decision Table RULE 1RULE 2RULE 3RULE 4 Conditions Actions

Precondition : what is true/must be true before the method or operation is executed Postcondition: what is true/must be true after the method or operation is executed. Where have we seen pre and post conditions before?

Example : enrol(student, module) Precondition Postcondition

Object Constraint Language (OCL) This is used if a much more formal and precise specification is needed. This is a language with a strict syntax used to specify, for example, pre and post conditions.

in some cases there may be a need to describe an object’s logic or internal behaviour- though this is essentially a design activity

Algorithmic Approaches Algorithm- describes the internal logic of a process or decision by breaking it down into small steps. Uses sequence, selection, iteration and recursion Example Approaches Structured English/pseudocode Activity diagrams, flowcharts

Structured English Operation: withdraw_cash (amount) If amount <= bank balance Subtract amount from bank balance Otherwise Display bank balance Display error message.

Pseudocode If amount <= bank balance { balance = balance – amount; success =true; else { Display bank balance Display error message Success = false } return(success)

Activity diagrams e.g. Make Booking systemcustomer

Example: An operation in monopoly to check whether a player can buy a hotel If the player has the full colour set AND none of them are mortgaged AND the player has four houses on the property AND the player has enough money for one house They can exchange the four houses for a hotel. If they have the full colour set AND none of them are mortgaged AND they have less than four houses, AND enough money for one house, they can buy a house..... If they have the full colour set,..... Use a decision table to lay out the rules more efficiently

An operation is required to calculate a fine for an overdue DVD loaned by a video shop. The number of days overdue is calculated by subtracting current date from the due date. If the DVD is a category A ( current top 10), then the fine is €1 per night for the first 15 nights, and thereafter the full cost of the DVD will be charged. If the DVD is a category B, the fine is €0.50 per night for the first 20 nights and thereafter the full cost of the DVD will be charged. For DVDs of category C (old DVDs) the charge is €0.30 per night for the first 20 nights and after that there is no further charge.

class loan { dvd id : int category : char loan date : date due date : date float calculate_fine(todaysdate:date) }

Operation calculate fine 1. Draw a decision table 2. Write some pseudocode or structured english 3. Draw an activity diagram

Conditions Category AYYNNNN Category BNNYYNN Category CNNNNYY >15 nights overdueNYNNNY >20 nights overdueN-NYNY Actions Charge cost of DVD** Charge 0.30 *20* Charge €1 per night* Charge €0.50 per night* Charge €0.30 per night*