Revision Session 3 Adding the detail and design for re-use.

Slides:



Advertisements
Similar presentations
Design by Contract.
Advertisements

Withdrawal Transaction Use Case Primary Actor: Customer Pre-conditions: The customer must have a valid ATM card and PIN. Post-conditions: The customer.
Ch:8 Design Concepts S.W Design should have following quality attribute: Functionality Usability Reliability Performance Supportability (extensibility,
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
Chapter 3: Modularization
Solutions to Review Questions. 4.1 Define object, class and instance. The UML Glossary gives these definitions: Object: an instance of a class. Class:
Classes and Object- Oriented... tMyn1 Classes and Object-Oriented Programming The essence of object-oriented programming is that you write programs in.
OOAD Using the UML - Use-Case Analysis, v 4.2 Copyright  Rational Software, all rights reserved 1/18 Use Case Analysis – continued Control Classes.
Introduction To System Analysis and Design
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 5: Restaurant.
Revision Session 1.UML Overview 2.Detailed software design : operation specification, designing for re-use.
Component-Level Design
1 CS 426 Senior Projects Chapter 19: Interfaces and Components [Arlow & Neustadt 2005] February 28, 2008.
Refining the Structure of the Requirements Model Aim: To create the conditions for software re-use. Bennett, McRobb and Farmer ch 8.
Software Engineering 1 Provisional Revision Plan.
Irwin/McGraw-Hill Copyright © 2004 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS6th Edition.
THE OBJECT-ORIENTED DESIGN WORKFLOW Interfaces & Subsystems.
© 2005 Prentice Hall8-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
Documenting Requirements using Use Case Diagrams
Software Requirements
Data and Process Modeling
University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution.
Requirements Analysis 2 What objects collaborate to achieve the goal of a use case?
Modified from Sommerville’s originalsSoftware Engineering, 7th edition. Chapter 8 Slide 1 System models.
1 CS 691z / 791z Topics on Software Engineering Chapter 17: Interfaces and Subsystems [Arlow & Neustadt, 2002] March 6, 2007.
Object Specification Moving towards a more precise specification of software.
Use Case Analysis – continued
Object-Oriented Analysis and Design
Introduction To System Analysis and design
Object Oriented Software Development
Chapter 13 Starting Design: Logical Architecture and UML Package Diagrams.
System models Abstract descriptions of systems whose requirements are being analysed Abstract descriptions of systems whose requirements are being analysed.
Use Case modelling 1. Objectives  Document user requirements with a model  Describe the purpose of an actor and a use case  Construct a use case model.
An Introduction to Software Architecture
Ch:10 Component Level Design Unit 4. What is Component? A component is a modular building block for computer software Because components reside within.
CSC 395 – Software Engineering Lecture 13: Object-Oriented Analysis –or– Let the Pain Begin (At Least I’m Honest!)
System models l Abstract descriptions of systems whose requirements are being analysed.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Systems Analysis and Design in a Changing World, 3rd Edition
NI ©UNITEN 2000/01 1 Faculty of Applied Engineering and Urban Planning Software Engineering Department Class Diagram Faculty of Information system Technology.
Requirements Engineering Methods for Requirements Engineering Lecture-30.
9-1 © Prentice Hall, 2007 Chapter 9: Analysis Classes Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey.
Use Case Diagram The purpose is to communicate the system’s functionality and behaviour to the customer or end user. Mainly used for capturing user requirements.
Distribution and components. 2 What is the problem? Enterprise computing is Large scale & complex: It supports large scale and complex organisations Spanning.
Part VII: Design Continuous
Data Structures and Algorithms Dr. Tehseen Zia Assistant Professor Dept. Computer Science and IT University of Sargodha Lecture 1.
Chapter 19: Interfaces and Components [Arlow and Neustadt, 2005] University of Nevada, Reno Department of Computer Science & Engineering.
Chapter 5 System Modeling. What is System modeling? System modeling is the process of developing abstract models of a system, with each model presenting.
7-1 © Prentice Hall, 2007 Topic 7: Analysis Classes Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey.
Chapter 1 Data Abstraction: The Walls CS Data Structures Mehmet H Gunes Modified from authors’ slides.
Copyright © Craig Larman All Rights Reserved COMP-350 Object-Oriented Analysis and Design GRASP: Designing Objects with Responsibilities Reference:
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
Object Design More Design Patterns Object Constraint Language Object Design Specifying Interfaces Review Exam 2 CEN 4010 Class 18 – 11/03.
CHAPTER 6 OBJECT ANALYSIS.
UNIT-IV Designing Classes – Access Layer ‐ Object Storage ‐ Object Interoperability.
Analysis Classes Unit 5.
Software Engineering: A Practitioner’s Approach, 6/e Chapter 11 Component-Level Design copyright © 1996, 2001, 2005 R.S. Pressman & Associates, Inc.
The Process of Object Modeling
Component-Level Design
Service-centric Software Engineering
Component-Level Design
Object-Oriented Design
An Introduction to Software Architecture
Chapter 19: Interfaces and Components
Chapter 19: Interfaces and Components
Software Analysis.
Interfaces and Components
Chapter 19: Interfaces and Components
Presentation transcript:

Revision Session 3 Adding the detail and design for re-use

2. Detailed software specifcation What are operation specifications used for in systems analysis? – Used to describe the detailed behaviour of the system. – adds detail and precision so that user can check if requirements are met. E.g. what to check before debiting a bank account? – Provides more detail for software design and helps in coding.

Discuss, with the aid of examples, some different ways of specifying operations, both declarative and procedural. Using 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 - give an example to show you understand

Non-algorithmic (Declarative )methods 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

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.

Example : enrol(student, module) Precondition enrol(student, module) 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.

Algorithmic methods 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

An operation is required to calculate a plane fare. First class passengers are charged the first class fare and have 20kg baggage free and free seat pre-booking. Above 20kg they are charged €2 per kilo over and €20 per large item like golf clubs. Normal passengers pay €2 per kilo for all baggage and and €20 per large item like golf clubs. They may pre-book a seat but will pay €5 for this. Write an operation specification for the above operation using an appropriate method or combination of methods. You are also required to justify your particular choice of method/methods.

1.Need to identify method(s) e.g. operation signature specifies operation as a black box, decision table shows internal logic. 2.Say why you’ve picked these– here we use a decision table because we want to specify actions to be taken based on a series of conditions. Decision tables are useful for situations where there are many outcomes depending on various combinations of input conditions. 3.Draw the table

Need to specify operation signature Calculateplanefare (passengerclass: pclass, baggagewgt:float,largeitems:int,reservedseat:boolean): money What does this operation need to know to calculate a plane fare? What does it return? [ what does it do?] Are there any significant pre and post conditions? What kind of object would this operation belong to?

Identify actions (red) and conditions (green) An operation is required to calculate a plane fare. First class passengers are charged the first class fare and have 20kg baggage free and free seat pre-booking. Above 20kg they are charged €2 per kilo over and €20 per large item like golf clubs. Normal passengers pay €2 per kilo for all baggage and and €20 per large item like golf clubs. They may pre-book a seat but will pay €5 for this.

Algorithmic method ? If (passclass === first) { fare = firstclassfare; IF ( baggage>20) THEN { fare = fare + (baggage-20)*2; } IF (largeitem >0 ) THEN { Fare = fare+(largeitems*20) } Else {…………………………}

Discuss three approaches to software reuse. Import existing components or structures from beyond the project boundaries (e.g. re-use of platform- specific components e.g..Net). Reuse components of current project- identify existing components or design with re-use in mind. Design new components for use within other projects.

Refinement of software specification can be done through : (i) abstracting common elements i.e. identifying where you can use generalisation/inheritance) and (ii) the encapsulation of composite structures and components.

Discuss the meaning of the following concepts, for each indicating how it can contribute to quality software development: 1. Generalisation (inheritance) 2. Encapsulation 3. Components 4. Patterns

Inheritance/generalisation identifying those aspects of a design that are relevant to more than one situation and redesigning your classes to put the common aspects in a parent class and the specific aspects in a child class. Abstract classes are parent classes which have no members in themselves but specify common aspects of a number of (concrete) child classes which can be reused easily. ISA –IS A KIND OF is the key relationship here. Enables easy software modification and re-use, thus contributing to reusability, extensibility

Generalisation- identifying commonalities- behaviour or attributes e.g. What do trainers, students, examiners have in common? They are all water safety members, and have an ID, name,address etc. and may have 0 or more qualification What do chance and community chest have in common? What do utilities, train stations and other properties have in common?

2. Encapsulation design software that can be used as a black box component. To use it you only need to know how the interface works – not the implementation. This means that you can have different implementations for the same interface, which could be useful, for example in porting an application to different platforms, or using different forms of data storage. The focus is on the external behaviour, but ignoring the detail of how that behaviour is produced. Enables software that is more maintainable, as change is localised, and portable as implementation can be hidden.

Example : property list Class propertylist -properties:property[] -nproperties:int Findfirst():property Getnext():property Addproperty(P: property) Removeproperty(propertyID:string):boolean Findproperty(propertyID:string) Getproperties():boolean Saveproperties():boolean Note that to use this class that we do not need to know how it does things e.g. how properties are got or saved, we just need to know each operations signature.

Encapsulation/Composition involves encapsulating a group of classes that have the capacity to be a re-usable subassembly. The relationship here is ISA Part Of. Composition – is made up of... A car has an engine Aggregation- can have 0 or more – sand grains on the beach

Example- design re-usable assemblies A newspaper advert can be composed of copy(text), graphics and a photograph. Graphics NewspaperAdvert Text Photo 0..*1..* 0..* 1..*

3. Components Relatively complex structures developed separately to be plugged together. Meet a clear-cut but general need. Have more than 1 simple well-defined external interfaces.

UML Support for Modelling Components Component A has a provided interface which offers services to components that know how to request those services. Component B has a required interface which requests services from a provided interface on another component. (basically it will send a message using a defined operation and parameters frpm some provided interface).

Ball and socket diagram. Component AComponent B

In UML, a component diagram provides a physical view of the system. Its purpose is to show the dependencies that the software has on the other software components (e.g., software libraries) in the system. The diagram can be shown at a very high level, with just the large-grain components, or it can be shown at the component package level i.e. class container levels such as.NET's namespaces (e.g., System.Web.UI).

Component-Based Development The classes that comprise an individual component need to be identified, modelled, specified designed and coded. Components must be designed to a common standard e.g. – A component’s behaviour is described by its specification. – A specification can have many implementations e.g. to work on many platforms.

Example: Airline Booking System In airline systems there is often a mix of systems, including older systems and other different systems trying to do the same things. Systems need to be designed to enable the upgrading of older systems with minimum fuss and to enable the use of different types of booking process. A Bookings component provides an interface called makebooking which is available to any system who knows how to use it i.e. knows the services provided and their protocols or signatures

What are class stereotypes and why are they useful? What are the advantages of this way of partitioning a system using entity, boundary and control class stereotypes?

1. Entity Classes -used to model data and behaviour of some real life system concept or entity e.g. member, bank account, order, employee. These will sometimes require more persistent storage of information e.g. a student’s details are ultimately stored as a student record. Represent the more permanent aspects of an application so class descriptions are less likely to chage e.g. members will always be added, updated and removed from a membership system.

2. Boundary (interface) Classes - model the interaction and manage communication between the computer system and its users. but don’t directly represent the specific interface object used to identify the main logical interfaces with users and other systems (including e.g. other software packages, printers). main task is to translate information across system boundaries partition the system so that interface is kept separate from business logic These will end up as describing screens, reports, HTML pages, or other system interfaces that actors interact with.

3.Control Class glue between boundary elements and entity elements, describing the logic required to manage the various elements and their interactions Represent coordination, sequencing, transactions and control of other objects Represents the calculation and scheduling aspects if the logic of the use case i.e those bits of functionality that are not specific to the entity class but are specific to the use case.

Why are they useful? Stereotyping boundary classes means that the system is partitioned so that any changes to the interface or communication part are localised there. Stereotyping entity classes provide a model of the more permanent aspects of the application domain The control classes represent the calculation and scheduling aspects of the logic of the use case. If the functionality required changes, then the change can be localised.

Packages and Dependencies We can use this to organise classes into packages in such a way that change is localised. Minimise dependencies between these packages ensures the system remains robust in the face of changing requirements.

Example Agate (p246) Packages mark out related but distinct application areas: advert preparation, staff management, campaign management. campaign management Control staff management advert preparation User Interface

Software Design-related Topics What are the key characteristics of a quality software design and how can they be achieved? What is meant by coupling and cohesion and how can addressing these concepts help improve the quality of a software design? How can these principles be applied in the detailed design of a system? Explain how a layered approach to software design can make software more portable, flexible and extensible.