300144 300888 Object Oriented Analysis
2021-Session 1
Dr Mahsa Razavi
Object Oriented Analysis – 300144 1
Lecture 7b Mid-term Revision
References
Lecture 1~6 and specified readings
Practical 1~6 (tutorial questions and project exercises)
Object Oriented Analysis – 300144 2
Main Topics of Lecture
• Highlights of Lecture 1-6
• Sample questions for checking understanding
• Next stage of Unit teaching and learning
Object Oriented Analysis – 300144 3
Highlight of Lecture 1
• Introduction to OOA
• Positioning Object Oriented Analysis
• Object Oriented Paradigm
• Introduction to UML
Object Oriented Analysis – 300144 4
Why analysis?
• Analysis of a system requires
– when starting from scratch
– when responding to a change request during the maintenance of an existing system
– when replacing legacy systems with new ones • Its primary goal is to answer the question
– What is the problem that needs to be solved – the requirements?
Object Oriented Analysis – 300144 5
Requirement Analysis
• Requirements for a software system are initially generated during the analysis phase of software development and are, typically:
– simple statements of desired functional capabilities • “the system should allow its users to sort records by
priority”
– statements of non-functional capabilities
• “the system should support 10,000 simultaneous users” – statements of constraints that must be met
• “the system will be run cross platform”
Object Oriented Analysis – 300144 6
Requirement Analysis (Cont.)
• The problem? Experienced developers will tell you that
– Requirements are usually incomplete and unable to tell the
whole story
– Requirements are typically wrong: factually wrong or become obsolete
– Users thus the requirements they requested are misleading. Users may be non-technical and may not understand the range of options that could solve their problem.
– Most importantly, “requirements are always changing”. • Needs changes
• Better ideas
• Environment changes
Object Oriented Analysis – 300144 7
OO analysis, design and programming techniques provide you with powerful tools to handle changes of software.
Object Oriented Analysis – 300144 8
Object-oriented paradigm
• Objects are conceptual units that combine both data and behavior
– The data of an object is referred to by many names: attributes, properties, instance variables, etc.
– The behavior of an object is defined by its set of methods
• Objects inherently know what type they are. Its attributes allows it to keep track of its state. Its methods allow it to function properly
• OO Analysis & Design is centered around the concept of objects. It produces systems that consist of objects collaborating to fulfill the responsibilities (requirements) of the systems
Object Oriented Analysis – 300144 9
Object-Oriented A,D&P
• Object-Oriented Analysis (OOA) is method which examines requirements from the perspective of the classes and objects found in the vocabulary of the system.
• Object-Oriented Design (OOD) refers to any method that encompasses the process of object-oriented decomposition and a notation for depicting both logical and physical as well as static and dynamic models of the system under design.
• Object-Oriented Programming is a method of implementation in which programs are organised as cooperative collections of objects, each of which represents instance of some class, and whose classes are related to one another via composition and inheritance relationships.
Object Oriented Analysis – 300144 10
Four Uses of the UML
SPECIFYING
VISUALISING
CONSTRUCTING
DOCUMENTING
Object Oriented Analysis – 300144 11
Four Uses of the UML (Cont.)
• VISUALISING: Use notations diagrams to represent graphic models of Requirements to design, e.g. business processes, solution and architecture
• SPECIFYING: Facilitate specification of some of the artifacts, eg. actors, use cases, classes, attributes, operations
• CONSTRUCTING: UML models can be directly connected to a variety of Programming Languages (C++, Java, VB, SmallTalk)
• DOCUMENTING: Documentation, e.g. Requirements, Architecture, Design, Project Plans, Tests, Prototypes etc. is used to enhance specifications and visual representations
Object Oriented Analysis – 300144 12
Highlight of Lecture 2
• Objects and classes
• Fundamentals of Object–Orientation
– Classification – Abstraction
– Inheritance
– Encapsulation – Polymorphism
Object Oriented Analysis – 300144 13
Class & Object
• A Class is a DEFINITION, a TEMPLATE, for the Objects
• NOTE: A Class is NEITHER an Individual Object, NOR simply a Collection of Objects
• A Class represents a Whole Set of Objects • Objects are instances of classes
Object Oriented Analysis – 300144 14
Class & Object Example
• Contract for property sale could be defined as a class (provide a template with certain format, including the terms and conditions of the sale and valuable information about the land)
• A property cannot be put on the market until a contract of sale has been drawn up. That contract linked with a particular property is an object of the defined class.
Object Oriented Analysis – 300144 15
The Star of OO Fundamentals: Cornerstone of Object-Orientation
CLASSIFICATION
Fundamentals of Object-Orientation: THE OBJECT
Object Oriented Analysis – 300144 16
OO Fundamentals
• Classification: groups things that have a common structure & exhibit a common behavior, the starting point of object analysis
• Abstraction: denotes the essential characteristics, from Objects to Class and from concrete classes to abstract classes.
• Inheritance: represents an ‘IS-A” relationship to enable significant code reuse
Object Oriented Analysis – 300144 17
OO Fundamentals (Cont.)
• Encapsulation: controls the accessibility of the features of the objects for information hiding in order to increase system robustness and code reusability
• Polymorphism: is able to refer to different derivations of a class in the same way, but getting the behavior appropriate to the derived class being referred to
Object Oriented Analysis – 300144 18
Case study: An example in Java
class Polymorph {
public static void main(String[] args) {
Polygon poly1, poly2, poly3; poly1 = new Rectangle(); poly2 = new Triangle();
poly3 = new Polygon(); poly1.set_values (4,5); poly2.set_values (4,5); poly3.set_values (4,5); System.out.print( poly1.area()
+“\n” + poly2.area()+ “\n“ + poly3.area()+ “\n”); }
}
20 10 0
object
polymor phism
class
encapsu lation
class Polygon {
protected int width, height;
public void set_values (int a, int b) {
width=a; height=b; } int area () {
return 0; } }
class Rectangle extends Polygon {
int area () {
return width * height; } }
class Triangle extends Polygon { int area () {
return (width * height / 2); } }
inheritance
Output:
Classification: many shapes could be grouped together Abstraction: defined a class Polygon from these shapes.
Object Oriented Analysis – 300144 Object Oriented Analysis, 300144
19
Highlight of Lecture 3
• Understanding Software Processes and Lifecycles
– Phases of Software Development
– Iterative and Incremental Development – The Unified Process
• Business Evaluation and Scoping Requirements
– Critical Requirement Analysis
– Package Diagrams As Sub-system
Object Oriented Analysis – 300144 20
Problems of Waterfall model
• Takes no account of evolutionary change
• System is characterised by a single function – a
questionable concept
• Based on functional mindset; data structure aspect often neglected
• Does not encourage reusability
Object Oriented Analysis – 300144 21
Iterative
• Updatethesameentity(e.g.ausecase,package or a class)
• Gradually refine the strategic and tactical decisions, converging on a solution that meets the user’s requirement and yet is simple, reliable and adaptable
• Validate and verify at predetermined steps
Object Oriented Analysis – 300144 22
Incremental
• Extend the current models by adding new entities /things to them
• Validate and verify at predetermined steps
Object Oriented Analysis – 300144 23
Unified Process
• Inception — approximate vision, business case, scope, vague estimates.
• Elaboration — refined vision, resolution of high risks, iterative implementation of core architecture, identification of most requirements and scope, more realistic estimates.
• Construction — iterative implementation of the remaining lower risk and easier elements, and preparation for deployment.
• Transition — beta tests, deployment.
Object Oriented Analysis – 300144 24
Rational Unified Process (RUP)
• A refinement of the unified Process created by the Rational Software Corporation, a division of IBM
• RUP Building blocks
– Main building blocks: Roles, Work products and Tasks
– Each iteration tasks are categorised into six engineering and three supporting disciplines
• Four Project Phases
• Six Best Practices
– Develop iteratively
– Management requirements – Use components
– Model visually
– Verify quality
– Control changes
Object Oriented Analysis – 300144 25
Roles in OO Analysis
The core role with business and technical skills
Object Oriented Analysis – 300144 26
Roles in OO Analysis (Cont.)
• The main responsibilities of a Business Analyst (BA) role within the problem space
– Models the requirements and explains the models to the designers
– Facilitates a dialogue between users and programmers
– Decomposes and ranks business objectives
– Verifies models
– Assists in organising tests
Object Oriented Analysis – 300144 27
Critical Requirements Analysis
• Good Requirement Analysis requires:
– Understanding the problem by breaking it down
– Prioritisation of the problem by evaluating the various sub-components of the problem
• A formal way of doing it is called Critical Requirement Analysis (CRA)
• CRA is vital for any analysis process
– Helps creation of manageable chunks (sub-systems) – Helps understand which chunks to develop first
Object Oriented Analysis – 300144 28
Package & Package Diagram
• Package: a Logical Collection of anything – of Classes; of Components;
– of Use cases etc. • Package diagram
– Provides clarity and understanding in a complex systems development
– Provides encapsulation and containment, support modularity
– Provide abstraction at multiple levels, from systems to classes in a component
Object Oriented Analysis – 300144 29
Critical Requirements Analysis
Put the detailed Business Objective like “To Enable e- Business in a Cost Effective Way “
Critical Performance Areas
Object Oriented Analysis – 300144 30
Package Diagram
Store Management System Package Diagram
Object Oriented Analysis – 300144 31
Highlight of Lecture 4
• Introduction to Actors
– Primary Users of the System
– Actors as Roles
– Actors as Devices and External Systems – Actor Documentation and Hierarchies
• Introduction to Use Cases – How to elicit good Use Cases
– How to create Use Case documentation
Object Oriented Analysis – 300144 32
Who can be an actor?
• The users (different roles) of the system are usually actors, Bank Teller, Manager, Customer
• External Devices may be actors, e.g. ATM, Card Reader, Printer
• External systems may be actors, e.g. PayPal
• Organisations may be actors, e.g. the government
• External to the system under design; taking initiative and/or interacting with the system
• Having a goal to achieve through a use case
Object Oriented Analysis – 300144 33
Potential list of actors in
Real Estate Agency Management System
A10-Client
A50-Staff
A80-Admin A70-Accountant
A90-Department of Home Affairs
A01-CardReader
A20-Buyer
A60-Agent
A95-Fair Trading NSW
A02-Printer
A30-Tenant
Public User
A75-Cashier A62-Consultant A64-Auctioneer
Staff User
A92-Real Estate Association NSW
Association
Hardware
Object Oriented Analysis – 300144
34
Actor hierarchy
Actor hierarchy in Hospital Management System
Abstract Actors
A10-Patient
A50-Staff
A20-PrivatePatient
versus Concrete Actors
A30-PublicPatient A60-Doctor
A70-Nurse
A80-Administrator
A62-Surgeon
A64-Physician
A75-LabAssistant
Object Oriented Analysis – 300144
35
Documenting Actors
• Actor Thumbnail
–
• Actor Type, Stereotype, Package
–
• Actor Description
–
• Actor Relationships
–
• Interface Specifications
–
• Author & History
–
• Reference Material
–
Object Oriented Analysis – 300144 36
Use Case Model
• The use case model is a tool analysing how different types of actors interact with the system to achieve their goals.
• The use-case model contains, as a minimum, the following basic model elements:
– Actors
– Use Cases
– Associations: the relationships between actors and use cases.
Object Oriented Analysis – 300144 37
Elicit Use Cases
• User Workshops
– Following the Joint Application Design style – Playing various Scenarios with Users
– Critical Requirements Analysis
• Formal and Informal Problem Statements • Knowledge of Domain Experts
• InterviewsandDiscussions
• Existing Systems (esp. Legacy)
• UseCasePatterns/PublishedLiterature/URLs
Object Oriented Analysis – 300144 38
Documenting Use Cases
• Use Case Thumbnail
–
• Use Case Description (Goal)
– • Stereotype and Package
–
–
• Post-Conditions
–
• Actors
–
• Use Case Relationships
–
Object Oriented Analysis – 300144 39
Documenting Use Cases (Cont.)
• Basic Course (Main Success Scenario/Basic Flow) – 1
– 2
– 3
–…
• Alternative Courses (Extensions/Alternative Flows)
–
• Exceptions
–
–
–
Object Oriented Analysis – 300144 40
Documenting Use Cases (Cont.)
• User Interface Specifications
–
• Metrics
–
–
• Status
–
–
–
Object Oriented Analysis – 300144 41
ParticipateOnlineSale Use Cases
Use Case Thumbnail: UC50-ParticipateOnlineSale
Description: The use case shows process of Actor Client participates an online sale of a property. With the assistance of Agent, Client gives offers. Agent consults with Owner and take the offer. Client pays the deposit and sign the contract, and then pay the rest of the 10% price after the cooling period and exchange the contracts.
Stereotype and Package: <
Pre-Condition: The Client has registered for the online sale.
Post-Condition: Client pays the 10% of the purchase price after the cooling period and complete the exchange of the contracts.
Object Oriented Analysis – 300144 42
ParticipateOnlineSale Use Cases
Actors: Primary: Client, Agent, Owner
Secondary: Dept of Home Affairs, Bank System
Use Case Relationship: <
Type: Complex
Basic Flow:
1. Client input ID and Password for the online property sale.
2. System checks the ID and Password (A1)
3. Client gets the rules and guidance for the property sale (A2) 4. System invites first round offer
5. Client gives the first offer
6. Agent consults Owner (A3)
Object Oriented Analysis – 300144 43
ParticipateOnlineSale Use Cases
7. System invites second round offer
8. Client gives the second offer
9. Agent consults Owner (A4)
10. Client pay 0.25% of the purchase price and sign the contract. 11. Agent check Client’s residency status (A5)
12. Client pays the balance of the 10% purchase price 12.1 <
13. This use case ends
Alternative Flow A1:
1. System identifies invalid ID and/or password.
2. The alternate scenario is resumed at Basic Flow 1.
Object Oriented Analysis – 300144 44
ParticipateOnlineSale Use Cases
Alternative Flow A2:
1. Client is not happy with the price range and thus quit. 2. This use case ends
Alternative Flow A3:
1. Owner is not happy with the first round offers and thus cancels the sale. 2. This use case ends
Alternative Flow A4:
1. Owner takes the best offer made by another buyer. 2. This use case ends.
Alternative Flow A5:
1. Client is not eligible for the purchase of the property.
2. The signed contract is cancelled. 3. This use case ends.
Object Oriented Analysis – 300144 45
Highlight of Lecture 5
• Use Case Diagrams
• Relationships in use case diagram
• Activity Diagrams
• Relating Activity diagram to Use Case Diagrams
• UML’s Extensibility Mechanisms
Object Oriented Analysis – 300144 46
What is a Use Case Diagram?
• A Use Case Diagram is used to illustrate how actors use the system and visualise the relationships between actors and use cases.
•
Use case diagrams consist of 4 objects: – Actor
– Use case
– System (boundary)
– Package (The package is an optional element that is extremely useful in complex diagrams.)
Object Oriented Analysis – 300144 47
UML Notation for Use Case Relationships
:Actor
<
UsecaseB
Use case A <
UsecaseA
UsecaseD
<
Object Oriented Analysis – 300144
48
UsecaseC
“Human Resource’s Activities” Use Case Diagram
49
<
<
<
<
Object Oriented Analysis – 300144
Use Case Diagrams: Common Pitfalls!
• Looks like a spider’s web
– Abstract both Actors and Use cases and draw separate
‘abstract’ use case diagrams
• Too coarse or too fine granularity
– Experience needed to get it right
– Perhaps use case diagram patterns can help?
• Naming the use case (should use a verb like word)
• Impropriate use of use case relationship
• Impropriate use of actor hierarchy
Object Oriented Analysis – 300144 50
What is an Activity Diagram?
• Essentially a flow chart, able to visually show sequentially dependent business objects and includes decision points
• However, in addition to a flowchart, they also show:
– Multiple threads (using fork/join)
– Partitions (swimlanes) resulting in their use in Workflow modelling
• They do not have separate documentation within UML
Object Oriented Analysis – 300144 51
Object Oriented Analysis – 300144 52
Make New Booking Activity Diagram
Extending UML
• UML provides three mechanisms to extend itself further
– Stereotypes – Mechanism to classify anything and everything in UML, by far the most popular
– Tagged Values and Constraints • MaynotbeusedduringAnalysis
– Notes: Can be used to extend diagrams and add further value or explanation to all UML diagrams
Object Oriented Analysis – 300144 53
Highlight of Lecture 6
• Representing a class with UML Class Notation and documentation
• Translating a Class Diagram to code
• Identify classes from use cases
• Relationships in Class Diagram: – Inheritance, Association & Aggregation
• Multiplicities in Class Diagram
Object Oriented Analysis – 300144 54
<
A one word name for the class prefixed with the optional stereotype
Description
Briefly explain what the class is representing
Relationship
List other related classes
Attributes
List of attributes describing the class
Responsibility
Responsibility eventually translated into combination of attributes and behaviour
Business Rules
Special business rules and constraints
Complexity
A metric about the class’s complexity
Object Oriented Analysis – 300144 55
Class Documentation Template
UML Notation: class diagram
Stereotype:
Type of the Class. Entity for Analysis.
<
Patient
-name : String -dateOfBirth: Date
+register ()
Name of the Class
Attributes of the Class
Operations of the Class
Accessibility: + for public, – for private and # for protected
Object Oriented Analysis – 300144 56
Data Type
How to Identify Classes?
• Noun analysis of the text within Use Cases reveals first cut of a list of classes
• Otherdocuments,problemstatementsetc.canbe inspected for nouns as well
• These nouns represent entities in problem space, which are potential classes
• Attributes and responsibilities (methods) are added to these classes but at analysis level they might be incomplete and inaccurate.
Object Oriented Analysis – 300144 57
Relationship between Classes
• Classes can be related in a variety of ways – Inheritance: is-a relationship
– Association: is associated/is related relationship – Aggregation: has a / whole-part relationship
– Composition, Dependency …
Object Oriented Analysis – 300144 58
Multiplicities on Class Diagrams
• Associations can indicate the number of instances involved in the relationship: an object of one class deals with how many objects of another class by using 0..N; 1..N, 1..*, M..N, * etc. (aggregator has no more than 1 multiplicity and multiplicity is not applicable to the inheritance relationship)
• An association can also indicate directionality; all associations are assumed to be bi-directional by default; some associations may be designated as unidirectional if necessary
Object Oriented Analysis – 300144 59
Multiplicities on Class Diagrams
Multiplicity:
An Object of one Class Relates to How Many Objects of the Other Class
1..* 1..4
1..*
Operating Theatre
0..1 1..2
Dentistry
Hospital
Surgery
Medicine
Object Oriented Analysis – 300144
60
Department
Doctor
“Property For Auction” Class Diagram
• Owner and Property (1..*): aggregation relationship
• Property contains (aggregation) InspectionReport (structural and pest), associated with Advertisement, OpenHouse (*), Auction
• Auction associated with Registration (*) and Contract that in turn linked with Payment
• Bill associated with Payment (1..*)
• Agent inherited by Auctioneer, SaleConsultant and
SaleAssistant
• Agent associated with OpenHouse (*) , Auction(*) and Contract (*)
• Solicitor associated with Contract (*)
• Buyer (*) associated with Advertisement, OpenHouse, InpectionReport, Registration, Auction, Contract and Payment
• Owner associated with Contract
Object Oriented Analysis – 300144 61
Next stage of Unit teaching & learning
• Intro-session Exam is cancelled – Participation (Tutorial Exercise) 20%
– Applied Project 30%
– Final Exam 50%
– Assessment Scheme of OOA(Adv.) not changed
• There are no new tasks in Week 8 tutorial classes, which will be used for revision and completing previous exercises and get feedback from your tutor on your work.
• Catch up during Week 8 and following
break if you started late in the unit learning.
Object Oriented Analysis – 300144 62
Sample Multiple Choice Questions
1. A ‘Bank ATM’ class in the Bank Management System has an attribute called currentStatus which can have one of the values: active, idle or out of service. “active/idle/out of service” are referred to as various____________ of the Bank ATM object.
A. stereotypes B. multiplicities
C. states
D. operations (methods)
E. None of the above
*
Object Oriented Analysis – 300144 63
Sample Multiple Choice Questions (Cont.)
2 Which statement is FALSE regarding polymorphism?
A. Polymorphism refers to the ability of an object to provide different behaviours depending on its position in the class hierarchy.
B. Polymorphism is an important figure for the development of large and complex systems.
C. Polymorphism can reduce maintenance overheads and in general enhances code and design quality.
D. Polymorphism is the ability of a class to make its methods to
have different interfaces. E. None of the above is false.
*
Object Oriented Analysis – 300144 64
Sample Multiple Choice Questions (Cont.)
3 Responsibility of Business Analysers includes all of the following except
A. Models requirements and explains the models to designers
B. Facilitates a dialogue between user and programmer
C. Decomposes and ranks business objectives
D. Verifies models and organises acceptance tests
E. Generates a development schedule
Object Oriented Analysis – 300144
65
*
Sample Multiple Choice Questions (Cont.)
4 Which of the following does NOT describe the
core responsibility of a project manager?
A. To express the project’s plans in the various areas:
scope, time, cost, quality and process
B. To estimate the associated risk in accomplishing
the project plan
C. To gather and translate project requirements to the
team *
D. To monitor progress to see how the project stays
aligned to the plan
E. All of the above
Object Oriented Analysis – 300144 66
Sample Multiple Choice Questions (Cont.)
5 Which of following is NOT a valid relationship in Class Diagrams?
A. Inheritance B. Association C. Aggregation D. Extension * E. Composition
Object Oriented Analysis – 300144 67
Sample Multiple Choice Questions (Cont.)
6 Which of the following is NOT a direct outcome of critical requirement analysis (CRA)?
A. Business objective
B. Critical performance areas
C. Prioritisation of the critical performance areas
D. Packagediagram
E. None of above
*
Object Oriented Analysis – 300144 68
Sample Multiple Choice Questions (Cont.)
7 Which of following is FALSE about the
definition of an actor
A. the User of the system
B. anything externally that can send and receive messages to and from the system
C. not an actor if not interacting with the system directly *
D. anything that triggers an interaction from outside the system
E. none of the above
Object Oriented Analysis – 300144 69
Sample Multiple Choice Questions (Cont.)
8 Use Case Diagrams
A. are used to visualise the sequence of interactions
B. are used to visualise the structure of classes
C. are used to visualise the hierarchy of corresponding actors
D. are used to visualise use cases, actors and their interactions *
E. are used to replace use case documentation as a diagram speaks more than 1000 words
Object Oriented Analysis – 300144 70
Sample Multiple Choice Questions (Cont.)
9 An Activity Diagram
A. is essentially a flow chart
B. can show multiple threads
C. haspartitions(swimlanes)
D. is often used in workflow modelling
E. all of the above
*
Object Oriented Analysis – 300144 71
Sample Multiple Choice Questions (Cont.)
10 Which statement is FALSE about Class
Diagrams?
A. Multiplicities are normally 0, 1, *. It also supports for a range
number denoted by m~n *
B. From specification perspective, an association line with an arrow indicates navigability. The source class has responsibility of ‘knowing’ the target class but not the other way around
C. A role name explains how an object participates in the relationship.
D.BothAggregationandCompositionareof ‘whole-part’ relationship with Composition being more specific
E. None of the above is false
Object Oriented Analysis – 300144 72