Part 1: Structural Modelling

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 25

COMP2111 – System Analysis and Design

Module 3: Study Materials

Analysis Modelling II
Part 1: Structural Modelling
Study Outlines

• Object with its Attributes

• Creating CRC Cards

• Structural Modelling using Class Diagram


Object with its Attributes
• System Functionality represented by Functional
models

• Structural models represent system objects and


their relationships:

– People
– Places Object
– Things

.Alan Dennis, Barbara Wixom and David Tegarden, System Analysis and Design with UML, 2015, 5th Edition, ISBN: 978-1-119-13826-6
Structural Models

• Iterative process creation “Drawn”


– Draw Conceptual and Business-centric way
– Develop a technology-centric way describing the actual
databases and files
– Add more detail in each iteration

• Build a vocabulary for analysts & users


– Lets effective communication between analysts & users

.Alan Dennis, Barbara Wixom and David Tegarden, System Analysis and Design with UML, 2015, 5th Edition, ISBN: 978-1-119-13826-6
Main aim of structural models to:
 Find out the key data contained in the problem domain
 Build a structural model of the objects

Structural
Modeling

Solution Domain
Problem Domain
Fig. 1: Structural Modeling [Dennis et al. 2015]

.Alan Dennis, Barbara Wixom and David Tegarden, System Analysis and Design with UML, 2015, 5th Edition, ISBN: 978-1-119-13826-6
Classes, Attributes & Operations

• Classes
People instances, places, or things

• Attributes
Features that describe an instance of a class
(an object)

• Operations
Actions or functions that a class can do

.Alan Dennis, Barbara Wixom and David Tegarden, System Analysis and Design with UML, 2015, 5th Edition, ISBN: 978-1-119-13826-6
Relationships

• Describe how classes relate to one another

• Three basic types in UML

 Generalization (shows inheritance of attributes and operations,


a-kind-of relationships)

 Aggregation (assemblies, connect parts and show “a-part-of” or


“has-parts” relationships)

 Association (distinguish relationships between classes)


.Alan Dennis, Barbara Wixom and David Tegarden, System Analysis and Design with UML, 2015, 5th Edition, ISBN: 978-1-119-13826-6
Object Identification

• Use-case information “Textual Analysis”


– Nouns for classes, Verbs for operations

• People provide ideas “Brainstorming”


– Develop classes (objects)
– Define(‫دد‬1‫ )ح‬Class Attributes, Class Operations and
Relationships to other classes

.Alan Dennis, Barbara Wixom and David Tegarden, System Analysis and Design with UML, 2015, 5th Edition, ISBN: 978-1-119-13826-6
• Common Object Lists
– Physical things
– Incidents
– Roles
– Interactions

• Patterns
– Collaborating classes that provide solutions to common
problems (groups)
– Developed patterns provide a starting point for work in
similar domains

.Alan Dennis, Barbara Wixom and David Tegarden, System Analysis and Design with UML, 2015, 5th Edition, ISBN: 978-1-119-13826-6
Creating CRC Cards
• Index cards used to document the responsibilities
and collaborations of a class
• CRC stand for Class, Responsibilities, Collaborators

• Responsibilities
– Knowing (class attributes)
– Doing—(class operations)

• Collaboration
– Objects working together to service a request (request/reply in Client-
Server)
.Alan Dennis, Barbara Wixom and David Tegarden, System Analysis and Design with UML, 2015, 5th Edition, ISBN: 978-1-119-13826-6
Front-Page of CRC Card

Fig. 2: Front-Side of a CRC Card, [Dennis et al., 2015]

.Alan Dennis, Barbara Wixom and David Tegarden, System Analysis and Design with UML, 2015, 5th Edition, ISBN: 978-1-119-13826-6
Back-Page of CRC Card

Fig. 5.3: Back-Side of a CRC Card, [Dennis et al., 2015]

.Alan Dennis, Barbara Wixom and David Tegarden, System Analysis and Design with UML, 2015, 5th Edition, ISBN: 978-1-119-13826-6
Role and Benefit of CRC Cards

• Help find out‫كتشاف‬1‫ ا‬additional objects, attributes,


relationships & operations

• Use activity diagrams to run through the steps in


a scenario
– Identify an important use-case
– Assign roles to actors and objects

.Alan Dennis, Barbara Wixom and David Tegarden, System Analysis and Design with UML, 2015, 5th Edition, ISBN: 978-1-119-13826-6
Structural Modelling using Class Diagram

• A static model that shows classes and their relationships


to one another
• Elements
– Classes
• Objects (a person, place or thing)
• Attributes (characteristics of the class)
• Operations (activities the class can perform)

– Relationships (between classes)


• Depicted as lines between classes
.Alan Dennis, Barbara Wixom and David Tegarden, System Analysis and Design with UML, 2015, 5th Edition, ISBN: 978-1-119-13826-6
Attributes
• Properties of a class
– Person: last name, first name, address, etc.
– Attributes can be derived
• Preceded with a slash (/)
• e.g., age is derived from date of birth

• Visibility of an attribute:
– Restricts access to attributes to ensure consistency
– Public attributes (+): visible to all classes
– Private attributes (-): visible only to an instance of the defined class
– Protected attributes (#): visible only to an instance of the class in which
they are defined and its descendants
.Alan Dennis, Barbara Wixom and David Tegarden, System Analysis and Design with UML, 2015, 5th Edition, ISBN: 978-1-119-13826-6
Operations
• Common operations are not shown
– Create or delete an instance
– Return or set a value

• Types of Operations:
– Constructor: Creates an object
– Query: Makes information about the state of an object available
– Update: Changes values of some or all of an object’s attributes
– Destructor: Deletes or removes an object

.Alan Dennis, Barbara Wixom and David Tegarden, System Analysis and Design with UML, 2015, 5th Edition, ISBN: 978-1-119-13826-6
Relationships

• Represents associations between classes

• Classes may be related to themselves


– e.g., employees and managers who may be members of the
same class

• Multiplicity indicates how many of one class are related


to another class

.Alan Dennis, Barbara Wixom and David Tegarden, System Analysis and Design with UML, 2015, 5th Edition, ISBN: 978-1-119-13826-6
Multiplicities (Business Rules)

Department Boss Exactly one:


A department has one and
1 1 only one boss

Employee Child Zero or more:


An employee has zero to
1 *..0 many children

Boss Employee One or more:


A boss is responsible for
1 *..1 one or more employees

Fig. 4: Multiplicities in Class Diagram, [Dennis et al., 2015]

.Alan Dennis, Barbara Wixom and David Tegarden, System Analysis and Design with UML, 2015, 5th Edition, ISBN: 978-1-119-13826-6
Association Classes

• Well-known in many-to-many relationships.

• Applied to recorded “attributes” the relationship


between two classes.
– Students are related to courses; a Grade class provides an
attribute to describe this relationship
– Illnesses are related to symptoms; a Treatment class provides
an attribute to describe this relationship

.Alan Dennis, Barbara Wixom and David Tegarden, System Analysis and Design with UML, 2015, 5th Edition, ISBN: 978-1-119-13826-6
Generalization & Aggregation Associations

• Generalization shows inheritance

• Aggregation shows a logical “a-part-of” relationship

• Composition shows a physical “a-part-of” relationship

.Alan Dennis, Barbara Wixom and David Tegarden, System Analysis and Design with UML, 2015, 5th Edition, ISBN: 978-1-119-13826-6
Example of Class Diagram (1)

Fig. 5: Example of Class Diagram, [Dennis et al., 2015]

.Alan Dennis, Barbara Wixom and David Tegarden, System Analysis and Design with UML, 2015, 5th Edition, ISBN: 978-1-119-13826-6
Example of Class Diagram (2)

Fig. 6: A class diagram for online shopping system, [Kirill Fakhroutdinov, 2019]

.Alan Dennis, Barbara Wixom and David Tegarden, System Analysis and Design with UML, 2015, 5th Edition, ISBN: 978-1-119-13826-6
Simplifying Class Diagrams

• General ways of simplifying class diagrams:


– Show only concrete classes
– The view mechanism shows a subset of classes
– Packages show aggregations of classes

.Alan Dennis, Barbara Wixom and David Tegarden, System Analysis and Design with UML, 2015, 5th Edition, ISBN: 978-1-119-13826-6
Steps to Structural Models
‫خطوات النماذج اإلنشائية‬
• Create CRC Cards

• Review CRC Cards & identify missing objects,


attributes, operations and/or relationships

• Create the class diagram

• Review the class diagram


– Remove unnecessary classes, attributes, operations and/or relationships

• Incorporate patterns

• Review and validate the model


.Alan Dennis, Barbara Wixom and David Tegarden, System Analysis and Design with UML, 2015, 5th Edition, ISBN: 978-1-119-13826-6
Summary and Ending Points

You might also like