OOSAAD Topic 9 Complimentary System Analysis Methods
OOSAAD Topic 9 Complimentary System Analysis Methods
OOSAAD Topic 9 Complimentary System Analysis Methods
Unit Roadmap
This unit is separated to 12 lessons as below:
1. Introduction to Systems Analysis and Design
2. Requirements Elicitation
3. Introduction to Object-Oriented Analysis and Design (OOAD)
4. OO Methods, Methodologies and Tools; Use Case Modelling
5. Class Diagrams
6. Behavioural Models: State Diagrams; Activity Diagrams
7. Behavioural Models: Sequence Diagrams
8. Case Study
9. Complementary OO methods: CRC Cards and OCL
10. OO Design
11. Quality Management and Control/Software Quality Assurance
12. Unit Summary
Complimentary System Analysis Methods Topic 9 -
94
Learning Outcomes
Class-Responsibilities-Collaborator Cards
Agile Method created by Kent Beck and Ward Cunningham (1989)
CRC Card
Back of Card
data dictionary
Class Description:
type description
of class
Front of Card Attributes:
Class Name:
position Superclass:
in class Subclass:
hierarc
Responsibilitie Collaborators
hy
s: design focuses on behaviours
i.e. responsibilities, and not
attributes, thus attribute info
on back of card
• Can be written in Class(es) that help the class undertake its
structured English or use responsibilities
case style •Too many collaborators suggest high
coupling
Complimentary System Analysis Methods Topic 9 -
98
Responsibility = Obligation
to perform a task or know
information
Complimentary System Analysis Methods Topic 9 -
911
Identifying Responsibilities
• Object role stereotypes RDD Principles
and purpose statements 1.Maximise
• Use cases and scenarios abstraction: Hide
• Conditional chains distinction
• Relationships and between data and
dependencies behaviour
• Class Life events 2.Distribute
Behaviour:
• Technical aspects of Delegated control
software environment architecture with
smart objects
3.Preserve
Flexibility
Complimentary System Analysis Methods Topic 9 -
912
Checkpoint Summary
• CRC Cards promote Responsibility driven design
- Helpful for identifying class relationships/collaborations
- Provide useful links between Class diagrams, Use case
and Interaction Diagrams
• Component Diagrams and Package Diagrams
can also be used to show sets of collaborating
classes (not covered at this level)
Used on Classifiers:
types, classes, interfaces, associations acting as types, data types,
attributes, association ends, methods
OCL Characteristics
Strongly typed language (Like java, Eiffel, C#,
Delphi…)
Each expression evaluates to a type:
‒ Predefined types
• Primitive / Basic Types: integer, real, boolean, string, date
• Collection types: Set, Bag, OrderedSet, Sequence
‒ User defined type
Conforms to rules of the type
Declarative
They specify and evaluate facts (i.e. what is true) not what
must be done
Similar operators to most Development Environments
Example of StarUML
prompts
Complimentary System Analysis Methods Topic 9 -
919
Using notes
Notes can be used to maintain readability of
diagrams {init: today()}
e.g
Customer derive: if getCategory() = “Education” or
”Charity” then 15% else 25%
StartDate: date
Inv: {getAge(dob)=>17
custDiscount: real
dob body: getAge(dob)=>17 and p.CanSee(eyes)
getAge(dob): - - These constraints are based on
companies operation code
integer
CanSee(eyes): }
Boolean
Comments: The note above includes an example of a
canDrive(): Boolean
comment
Add comments as development notes for yourself and
other developer
• added by preceding them with two dashes - - This is a
comment
Complimentary System Analysis Methods Topic 9 -
920
{self.Bus.disc=10%
Pensioner Customer
and
{customer.age>67} self.Dom.disc=15%}
customerid:string
{unique}
Predefined startDate: date
Constraint Assum
=today
es init
disc:real
Dom
Bus {getAge(dob)=>17 } Assumes
derive
BusinessName:stri {XOR} DoB:date also
ng /Age:int = {today-dob} implied
BusinessType:busty {readOnly}
by /
pes CanSee(eyes): Boolean
canDrive(): Boolean
Complimentary System Analysis Methods Topic 9 -
921
OCL Examples
gender: enum {female, male, non-binary}
Iteration-Based Operations
933
Navigation Operators
Two navigation operators
. (dot) described earlier: navigation/pathname
from an object
-> navigation from collection using property,
operation or iteration
e.g bagName->elemenType
setName->union(anotherSet)
setName->collect
If self.nationality=‘UK’ then
fee = 9000
else
fee = 14000
endif
Complimentary System Analysis Methods Topic 9 -
938
Main
OCL Eclipse plug-in (OCLInEcore)
USE, open source tool which supports UML class diagrams and OCL
Eclipses’ Model Development Tools (MDT) OCL component
Oclarity
iOCL (interactive OCL tool)
SimpleOCL
Object Constrained Language Environment (OCLE)
Alternatives to OCL
• Structured English
• Alloy: Open source declarative specification
language
• FOL (First Order Logic)
• SQL (Structured Query Language)
• Domain Specific Languages: specialised to
specific business rule patterns or problem
domain
• Semantics Of Business Vocabulary And Busin
ess Rules (SBVR)
• etc
Complimentary System Analysis Methods Topic 9 -
941
Topic Summary
This topic has covered CRC cards and OCL, both of which
are complimentary tools for UML
OCL can be difficult to write but is easy to understand
OCL lacks ambiguity: good when tools are used to automatically translate
models into code
Has no Maths but is mathematical in its formality of expression
OCL statements include
A context denoting the given situation,
A property representing characteristics of the context
Keywords: Avoid using OCL reserved words, like these, to describe user
defined elements but if unavoidable then enclose them in quotes
There are many other languages besides OCL
We have chosen it because it is adopted by OMG as a UML standard
Structured English can be used instead or development teams can come to
some agreements on custom syntax
When choosing a language consider its simplicity, maintainability, modularity
Complimentary System Analysis Methods Topic 9 -
942
Recommended Reading
• Braude, E. J. & Bernstein, M. E., 2011. Software Engineering: Modern
Approaches. 2nd ed. John Wiley and Son.
• Dennis, A., Wixom, B. & Tegarden, D., 2020. Systems Analysis and Design:
An Object-Oriented Approach with UML. 6th ed. John Wiley and Sons.
• Kung, D., 2013. Object-Oriented Software Engineering: An Agile Unified
Methodology. 1st ed. McGraw-Hill Education.
• Pressman, R. & Maxim, B., 2020. Software Engineering: A Practitioner's
Approach. 9th ed. McGraw Hill.
• Sommerville, I., 2021. Engineering Software Products: An Introduction to
Modern Software Engineering. Pearson.
• Stephens, R., 2022. Beginning Software Engineering. 2nd ed. Wiley and
Sons.
• Stevens, P. & Pooley, R., 2006. Using UML: Software engineering with
objects and components. 2nd ed. Addison-Wesley -
https://homepages.inf.ed.ac.uk/perdita/book/ .
• Warmer, J. & Kleppe, A., 2003. The Object Constrained Language:
Getting your models , 2nd Ed, Pearson Education. 2nd ed. Pearson
Education, Object Technology Series.
• Weisfeld , M., 2019. Object-Oriented Thought Process. 5th ed. Addison-
Wesley.
• Wirfs-Brock, R. B. & McKean, A., 2003. Object Design: Roles,
Object-Oriented System Analysis and Design
Topic 4- 4.44
Weblinks
• Object Management Group (OMG). (2015). OMG UML 2.5.1
specification, Available at:
https://www.omg.org/spec/UML/2.5.1/About-UML/ [Accessed 6
March 2024].
•
Stevens (2006), Using UML Software engineering with objects and
components
, Available at: https://www.google.co.uk/books/edition/Using_UML/
rDRE54yiwSUC?hl=en&gbpv=1&dq=stevens+Perdita [Accessed
6 March 2024].
• Object Management Group (OMG). (2015). OMG Object
Constraint Language (OCL) 2.4. Available at:
https://www.omg.org/spec/OCL/2.4/PDF
• Wirfs-Brock, R. (2006). A Brief Tour of Responsibility-Driven
Design. Available at: www.wirfs-brock.com;
https://www.wirfs-brock.com/PDFs/A_Brief-Tour-of-RDD.pdf:
articles and presentations. [Accessed 6 March 2024].
Object-Oriented System Analysis and Design
Topic 4- 4.45
Quiz 1
1. Which of the following items does not appear on a CRC card?
A) class collaborators B) class name
C) class reliability D) class responsibilities
2. Class responsibilities are defined by
A) its attributes only B) its collaborators
C) its operations only D) both its attributes and
operations
3. OCL can be used for:
A) Specifying invariants on classes and stereotypes and
types in the class model
B) Describing pre- and post conditions on Operations
and Methods
C) Describing Guards
D) All the above
E) None of the above
4. An OCL context can name a:
A) A class as nameClass e.g context patient
B) A use case as nameUsecase e.g context Complete
Object-Oriented System Analysis and Design
Topic 4- 4.46
1. x.y
2. c->func1()
3. x implies y
4. x->size()
5. x->includesAll(y)
6. x->excluding(elem1)
7. x->last()
8. Student self.registration=”yes”
9. [email protected]
Object-Oriented System Analysis and Design
Topic 4- 4.47
Class Activity
1. Declare an enumeration for colours of the rainbow and
explain that if car colour must match one of the colours. Add
an OCL constraint that Red cars have a 10% surcharge.
2. Draw a Venn diagrams to depict the union and intersection
for the following data: SetA{1,4,7,9,2,3,20}
SetB{8,1,7,3,40,50,60}
Declare the OCL statements that would extract the data.
3. Declare a calculated field to calculate the fee for lateness of
returning a library book at 50pence a day.
4. Medical Clinic Example
a) Produce a CRC Card for the Doctor Class in the earlier Medical Clinic
example that kept track of In-patient and Out-patient doctor-patient
appointments for private and public funded patients.
b) Modify the diagram and add OCL statements to declare that each doctor is
assigned a maximum number of patients
c) Consider three more constraints that could be added to the Clinic example
Topic 9:
Complementary OO methods:
CRC Cards and OCL
Any Questions?
Complimentary System Analysis Methods Topic 9 -
951
What’s Next?