WXGC6102: Object-Oriented Techniques Refining the Requirements Model References: Chapter 7 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis.

Slides:



Advertisements
Similar presentations
© 2010 Bennett, McRobb and Farmer1 Requirements Analysis 1: Requirements and Classes Based on Chapter 7 of Bennett, McRobb and Farmer: Object Oriented.
Advertisements

Chapter 22 Object-Oriented Systems Analysis and Design and UML Systems Analysis and Design Kendall and Kendall Fifth Edition.
1 Chapter 4 Dynamic Modeling and Analysis (Part I) Object-Oriented Technology From Diagram to Code with Visual Paradigm for UML Curtis H.K. Tsang, Clarence.
1 Chapter 4 Dynamic Modeling and Analysis (Part I) Object-Oriented Technology From Diagram to Code with Visual Paradigm for UML Curtis H.K. Tsang, Clarence.
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.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 8 Slide 1 System models.
03/12/2001 © Bennett, McRobb and Farmer 2002 Refining the Requirements Model Based on Chapter 8 of Bennett, McRobb and Farmer: Object Oriented Systems.
Refining the Structure of the Requirements Model Aim: To create the conditions for software re-use. Bennett, McRobb and Farmer ch 8.
Modified from Sommerville’s originalsSoftware Engineering, 7th edition. Chapter 8 Slide 1 System models.
Modified from Sommerville’s originalsSoftware Engineering, 7th edition. Chapter 8 Slide 1 System models.
© Copyright Eliyahu Brutman Programming Techniques Course.
03/12/2001 © Bennett, McRobb and Farmer Use Case Diagrams Based on Chapter 6 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and.
Chapter 2 Structural Modeling & Analysis
UML Class Diagrams: Basic Concepts. Objects –The purpose of class modeling is to describe objects. –An object is a concept, abstraction or thing that.
Chapter 6 View Alignment Techniques and Method Customization (Part I) Object-Oriented Technology From Diagram to Code with Visual Paradigm for UML Curtis.
Object-Oriented Analysis and Design
The chapter will address the following questions:
Objects What are Objects Observations
Refining the Requirements Model
Copyright by Dr. Clarence Lau, IVE(TY)
SOFTWARE ENGINEERING BIT-8 APRIL, 16,2008 Introduction to UML.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 1 System models l Abstract descriptions of systems whose requirements are being.
Chapter 4 System Models A description of the various models that can be used to specify software systems.
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.
University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 classes 1 Use CasesUse Case Model Campaign Management PackageModelSub-system.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 20 Object-Oriented.
What Is Object-Orientation?
1 WXGC6102: Object-Oriented Techniques Modelling Concepts References: Chapter 5 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and Design.
©Ian Sommerville 1995/2000 (Modified by Spiros Mancoridis 1999) Software Engineering, 6th edition. Chapter 7 Slide 1 System models l Abstract descriptions.
Programming in Java Unit 3. Learning outcome:  LO2:Be able to design Java solutions  LO3:Be able to implement Java solutions Assessment criteria: 
Association Class Generalization/Specialization Whole-Part Page More Associations 1.
Systems Analysis and Design in a Changing World, 6th Edition 1 Chapter 4 - Domain Classes.
Chapter 7 System models.
Systems Analysis and Design in a Changing World, 6th Edition 1 Chapter 4 Domain Classes.
System models l Abstract descriptions of systems whose requirements are being analysed.
Modified by Juan M. Gomez Software Engineering, 6th edition. Chapter 7 Slide 1 Chapter 7 System Models.
Structural Modeling. Objectives O Understand the rules and style guidelines for creating CRC cards, class diagrams, and object diagrams. O Understand.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 4: Restaurant.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
Software Engineering, 8th edition Chapter 8 1 Courtesy: ©Ian Somerville 2006 April 06 th, 2009 Lecture # 13 System models.
Sommerville 2004,Mejia-Alvarez 2009Software Engineering, 7th edition. Chapter 8 Slide 1 System models.
03/12/2001 © Bennett, McRobb and Farmer 2005 Refining the Requirements Model Based on Chapter 8 of Bennett, McRobb and Farmer: Object Oriented Systems.
03/12/2001 © Bennett, McRobb and Farmer 2002 Refining the Requirements Model Based on Chapter 8 of Bennett, McRobb and Farmer: Object Oriented Systems.
Class diagram Used for describing structure and behaviour in the use cases Provide a conceptual model of the system in terms of entities and their relationships.
Chapter 9 Applying UML and Patterns -Craig Larman
UML Class Diagram Trisha Cummings. What we will be covering What is a Class Diagram? Essential Elements of a UML Class Diagram UML Packages Logical Distribution.
Lecture 6: Structural Modeling
What is a Structural Model?
Lecture 1: UML Class Diagram September 12, UML Class Diagrams2 What is a Class Diagram? A class diagram describes the types of objects in the system.
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
Class Modeling Design Class diagram. Classes The term “class ” refers to a group of objects that share a common attributes and common behaviour (operations).
Object-Oriented Analysis and Design CHAPTERS 9, 31: DOMAIN MODELS 1.
Domain Classes – Part 1.  Analyze Requirements as per Use Case Model  Domain Model (Conceptual Class Diagram)  Interaction (Sequence) Diagrams  System.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 8 Slide 1 System models.
CS212: Object Oriented Analysis and Design Lecture 33: Class and Sequence Diagram.
Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects.
Lecture 14 22/10/15. The Object-Oriented Analysis and Design  Process of progressively developing representation of a system component (or object) through.
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
 To explain why the context of a system should be modelled as part of the RE process  To describe behavioural modelling, data modelling and object modelling.
OO DomainModeling With UML Class Diagrams and CRC Cards Chapter 6 Princess Nourah bint Abdulrahman University College of Computer and Information Sciences.
1 Kyung Hee University Interaction Diagrams Spring 2001.
Engineering, 7th edition. Chapter 8 Slide 1 System models.
Elaboration popo.
OO Domain Modeling With UML Class Diagrams and CRC Cards
Abstract descriptions of systems whose requirements are being analysed
UML Class Diagrams: Basic Concepts
SYS466 Domain Classes – Part 1.
Understand and Use Object Oriented Methods
Refining the Requirements Model
Presentation transcript:

WXGC6102: Object-Oriented Techniques Refining the Requirements Model References: Chapter 7 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and Design Using UML, (3 rd Edition), McGraw Hill, Object-Oriented Technology - From Diagram to Code with Visual Paradigm for UML, Curtis H.K. Tsang, Clarence S.W. Lau and Y.K. Leung, McGraw-Hill Education (Asia), 2005

2 In This Lecture You Will Learn: About reuse in software development; How object-orientation contributes to reuse; How to identify and model aggregation, composition and generalisation; An approach to modelling components; About ‘patterns’ in software development; How analysis patterns help to structure a model.

Software development has concentrated on inventing new solutions Recently, the emphasis has shifted Much software is now assembled from components that already exist Component reuse can save money, time and effort Reuse in Software Development

Achieving reuse is still hard – Reuse is not always appropriate – can’t assume an existing component meets a new need – Poor model organisation makes it hard to identify suitable components – The NIH (Not-Invented-Here) syndrome – Requirements and designs are more difficult to reuse than code

Reuse: The Contribution of OO Encapsulation makes components easier to use in systems for which they were not originally designed Aggregation and composition can be used to encapsulate components Generalisation allows the creation of new specialised classes when needed

Association Object-oriented systems are made up of objects of many classes. Associations represent relationships among classes. An association is represented by a line drawn between the associated classes involved with an optional role name attached to either end. The role name is used to specify the role of an associated class in the association. If an association connects two objects instead of classes, it is called a link. A link is an instance of an association.

Association (cont’d) Name of Link Multiplicity Role Name of Association

Qualification Qualification serves as names or keys that are part of the association and are used to select objects across the association at the other end. In UML, a qualifier is used to model this association semantic, that is an association attribute whose value determines a unique object or a subset of objects at the other end of an association.

Qualification Bank + account no => person

Association Classes Sometimes, it is necessary to describe an association by including some attributes which do not naturally belong to the objects involved in the association.

Association Classes (cont’d)

Aggregation and Composition Special types of association, both sometimes called whole-part A campaign is made up of adverts: Campaign Advert 0..*1 Unfilled diamond signifies aggregation

Aggregation is essentially any whole-part relationship Semantics can be very imprecise Composition is ‘stronger’: – Each part may belong to only one whole at a time – When the whole is destroyed, so are all its parts Aggregation and Composition

Aggregation Aggregation is a stronger form of association. It represents the has-a or part-of relationship. In UML, a link is placed between the “ whole ” and the “ parts ” classes with a diamond head attached to the “ whole ” class to indicate that this association is an aggregation. Multiplicity can be specified at the end of the association for each of the “ part-of ” classes to indicate the quantity of the constituent parts. Typically, aggregations are not named, and the keywords used to identify aggregations are “ consists of ”, “ contains ” or “ is part of ”.

Aggregation (cont’d)

An everyday example: Clearly not composition: – Students could be in several classes – If class is cancelled, students are not destroyed! Class Student 0..*1..* Aggregation and Composition

Composition A stronger form of aggregation is called composition, which implies exclusive ownership of the “ part-of ” classes by the “ whole ” class, i.e. a composite object has exclusive ownership of the parts objects. This means that parts may be created after a composite is created, but such parts will be explicitly removed before the destruction of the composite.

Composition (cont’d)

Another everyday example: This is (probably) composition: – Ingredient is in only one meal at a time – If you drop your dinner on the floor, you probably lose the ingredients too Meal Ingredient 1..*1 Filled diamond signifies composition Aggregation and Composition

Constraints and Notes Constraints are an extension of the semantics of a UML element, allowing one to add new rules or modify existing ones. Sometimes it is helpful to present an idea about restrictions on attributes and associations for which there is no specific notation. Constraints are represented by a label in curly brackets ({constraintName} or {expression}) that are attached to the constrained element.

Constraints and Notes (cont’d)

Example – A Sales Order System

Structural Analysis Techniques

Domain Modeling and Analysis Preparing the problem statement; Identifying objects and classes using textual analysis; Developing a data dictionary; Identifying associations between classes; Identifying attributes of classes and association classes; Structuring classes using inheritance; Verifying access paths for likely queries; and Iterating and refining the model.

Domain Modeling and Analysis (cont ’ d)

Identifying objects and classes To identify objects and classes, perform a textual analysis to extract all nouns and noun phrases from the problem statement. Nouns or noun phrases of the following categories are more likely to represent objects: – Tangible things (e.g. classroom, playground) – Conceptual things (e.g. course, module) – Events (e.g. test, examination, seminar) – Outside organizations (e.g. publisher, supplier) – Roles played (e.g. student, teacher, principal) – Other systems (e.g. admission system, grade reporting system)

Adding Generalisation Structure Add generalisation structures when: – Two classes are similar in most details, but differ in some respects – May differ: In behaviour (operations or methods) In data (attributes) In associations with other classes

Identifying Associations between Classes An association is a relationship between objects. For example, John and Peter are instances of the class Person and John is the father of Peter. Association can be identified by looking for verbs and verb phrases connecting two or more objects in the problem statement. e.g. “ A client may open one or more accounts for stock trading. ” – Name of the association: has or opened by? The name of the association should reflect the nature rather than the historic event.

Identifying Associations between Classes (cont’d) Verb phraseAssociation A client may open one or more accounts for stock trading.has When a client issues a buy order for an account, the client must specify the stock code, number of shares and the maximum price that he is willing to pay for them (the bid price). issued by, buy When a client issues a sell order for an account, the client must specify the stock code, the number of share and the minimum price that he is willing to sell them (the ask price). issued by, sell All trade orders will be forwarded to the stock trading system of the stock exchange for execution. executed by When an order is completed, the stock trading system of the stock exchange will return the transaction details of the order to the online stock trading system. returned by The transaction details of a trade order may be a list of transactions, and each transaction specifies the price and the number of shares traded. consists of

Identifying Associations between Classes (cont’d) From the domain knowledge, we have the following associations: – A stock is listed on a stock exchange. – A stock is traded on a stock trading system of a stock exchange. – The result of a trade order is a list of transactions. – A stock exchange has one or more stock trading systems.

Initial Domain Class Diagram

Identifying Attributes of Classes and Association Classes Attributes are properties of a class, such as name, address, telephone number of the Client class. Look for nouns or noun phrases followed by possessive phrases, e.g. “ address of the client ”. Adjectives that appear immediately before a noun corresponding to a class can also be an enumerated value of an attribute, e.g. “ a canceled buy order ”. Attributes are less likely to be discovered from the problem statement. However, it is not necessary to identify all attributes in this step because the attributes do not affect the structure of the domain class model. Instead we should only do so if they can be identified readily. We will be able to identify the attributes more readily at later stages of the development life cycle (e.g. detailed design phase).

Adding Structure Two types of staff: Have qualifications recorded Can be client contact for campaign Bonus based on campaigns they have worked on Creative Admin Qualifications are not recorded Not associated with campaigns Bonus not based on campaign profits

Adding Structure: calculateBonus ( ) StaffMember {abstract} staffName staffNo staffStartDate calculateBonus ( ) assignNewStaffGrade ( ) getStaffDetails ( ) CreativeStaff qualification assignStaffContact ( ) AdminStaff calculateBonus ( )

Structuring Classes Using Inheritance Two approaches: top down and bottom up Bottom-up approach : – similar class name – similar attributes – similar operations – similar associations e.g. the buy order and sell order classes both have the price and number of shares attributes and both of them are associated with the stock class and account class.

Structuring Classes Using Inheritance (cont’d)

Structuring Classes Using Inheritance (cont) Top-down approach: – check a class to see whether it has some special cases that have additional structural or behavioral requirements. – noun phrases consisting of adjectives and class names, e.g. sell order class and buy order class – taxonomies of real-life objects – domain knowledge, e.g. cash account and margin account

Structuring Classes Using Inheritance (cont’d)

Verifying Access Paths for Likely Queries Check whether the domain class diagram can provide the correct answers to queries that are common to other applications in the domain. In the online stock trading system example, a typical client query would be the current stock balance of his account. This requires an association between the account class and the stock class to provide the information on the number of shares held in the account.

Verifying Access Paths for Likely Queries (cont’d)

Iterating and Refining the Model It is highly unlikely that we are able to develop the correct domain class model in one pass. The domain class model needs to be refined several times before it becomes robust. The development of the domain class model is not a rigid process, and we need to repeatedly apply the above steps until the domain class model finally becomes stable.

Iterating and Refining the Model (cont’d) The following checklist can help you identify areas to improve the domain class model. – A class without attributes, operations and associations - consider removing the class. – A class with many attributes and operations covering a wide area of requirements - consider splitting the class into two or more classes. – A query cannot be answered by tracing the domain class model - consider adding additional associations. – Asymmetries in generalizations and associations - consider adding additional associations and restructuring the classes with inheritance. – Attributes or operations without a hosting class - consider adding new classes to hold these attributes and operations.

Standard UML techniques can be used to model components Component internals can be detailed in a class diagram Component interaction can be shown in a communication diagram Modelling Components in UML

UML has icons for modelling components in structure diagrams (e.g. class diagrams) « component » Payments TakePayment « component » Bookings Provided interface offers servicesRequired interface uses services Ball-and-socket connector maps provided interface of one component to required interface of another

Modelling Components in UML Structure diagrams can mix component icons with other icons, e.g. interfaces «interface» Allocate Seats GetFreeSeats(seatType) AllocateSeat(seatRef) DeallocateSeat(seatRef) Flight Management «component» «realize»

Software Development Patterns A pattern: “describes a problem which occurs over and over again in our environment, and then describes the core of a solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice.” Alexander et al. (1977)

Software Development Patterns A pattern has: – A context = a set of circumstances or preconditions for the problem to occur – Forces = the issues that must be addressed – A software configuration that resolves the forces

Software Development Patterns Patterns are found at many points in the systems development lifecycle: – Analysis patterns are groups of concepts useful in modelling requirements – Architectural patterns describe the structure of major components of a software system – Design patterns describe the structure and interaction of smaller software components

Software Development Patterns Patterns have been applied widely in software development: – Organisation patterns describe structures, roles and interactions in the software development organisation itself Anti-patterns document bad practice – Mushroom Management is an organisation anti- pattern

Simple Analysis Pattern Transaction transactionNumber transactionDate transactionTotal updateTransactionTotal ( ) TransactionLineItem TransactionLineNumber transactionLineQuantity transactionLineValue comprises *1

Accountability Analysis Pattern AccountabilityType Accountability Time Period Party Person Organization commissioner responsible ** * * 1

Analysis Patterns Pattern name: A descriptor that captures the essence of the pattern. Intent: Describes what the pattern accomplishes or represents Motivation: A scenario that illustrates how the pattern can be used to address the problem. Forces and context: A description of external issues (forces) that can affect how the pattern is used and also the external issues that will be resolved when the pattern is applied. Solution: A description of how the pattern is applied to solve the problem with an emphasis on structural and behavioral issues. Consequences: Addresses what happens when the pattern is applied and what trade-offs exist during its application. Design: Discusses how the analysis pattern can be achieved through the use of known design patterns. Known uses: Examples of uses within actual systems. Related patterns: On e or more analysis patterns that are related to the named pattern because (1) it is commonly used with the named pattern; (2) it is structurally similar to the named pattern; (3) it is a variation of the named pattern.

References Bennett, McRobb and Farmer (2005) Ambler (2003) Cheesman and Daniels (2001) Coad (1997) Fowler (1997) (For full bibliographic details, see Bennett, McRobb and Farmer) Object-Oriented Technology - From Diagram to Code with Visual Paradigm for UML, Curtis H.K. Tsang, Clarence S.W. Lau and Y.K. Leung, McGraw-Hill Education (Asia), 2005