Structural modeling class diagrams
This presentation is the property of its rightful owner.
Sponsored Links
1 / 22

Structural Modeling: Class Diagrams PowerPoint PPT Presentation


  • 120 Views
  • Uploaded on
  • Presentation posted in: General

Structural Modeling: Class Diagrams. Class Diagrams. Provide static view of system Most common type of diagram in OOAD Forms basis for component and deployment diagrams Shows Classes Interfaces Collaboration And their relationships. Classes. Definition of the word “ class ”

Download Presentation

Structural Modeling: Class Diagrams

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Structural modeling class diagrams

Structural Modeling: Class Diagrams


Class diagrams

Class Diagrams

  • Provide static view of system

  • Most common type of diagram in OOAD

  • Forms basis for component and deployment diagrams

  • Shows

    • Classes

    • Interfaces

    • Collaboration

    • And their relationships


Classes

Classes

  • Definition of the word “class”

    • Oxford: “a number of individuals having a character or feature in common”

    • Webster: “a number of persons or things regarded as forming a group by reason of common attributes, characteristics, qualities or traits”


Classes in everyday life

Classes in everyday life…

  • Based on similar values for a particular, or group of attributes

    • All purple dinosaurs; all green apples; all Jesuits

  • Based on the range of an attribute

    • Everyone who is between 18-21 years of age

  • Based on similar behavior

    • Everyone who sleeps in class; everyone in the ECIS program


All about classes

All about Classes

  • Based on the notion of abstraction

  • Starts with identification of all common characteristics of a set of elements

  • All objects belong to a class

  • Objects represent an instance of a class

  • Software objects are built from a class through instantiation


Representation of a class

Representation of a Class

CLASS NAME

Attributes

Operations ( )


Representation of a class1

Representation of a Class

MOTORCYCLE

Color

Maximum Speed

Engine

Start ( )

Brake ( )


Purpose of class diagrams

Purpose of Class Diagrams

  • To model the vocabulary of the system

    • What lies within and without the system

  • To model simple collaborations

    • To visualize the relationship between classes

  • To model a logical database schema

  • Three major types of constructs in class diagrams

    • Inheritance structure

    • Association structure

    • Aggregation structure


Additional concepts

Additional Concepts

  • Aggregation

    • A relationship between two classes where the instances of one class are, in some way, components, members , or contents of the instances of the other class (from Brown, 2002)

    • Types

      • Component (assembly)

      • Container (contents)

      • Collection (Member)


Aggregation component

Aggregation: Component

Car

Engine

Transmission

Body

Consists of

Car Part


Class hierarchies

Class Hierarchies

Vehicle

Land

Air

Car

Bike

Plane

Helicopter

(referred to as “Generalization”)


Problems with classification

Problems with Classification

Animal

Two-legged

Four-legged

Herbivore

Carnivore

Herbivore

Carnivore

Why should I classify this way instead of…


Class hierarchies1

Class Hierarchies

Animal

Herbivore

Carnivore

2 legs

4 legs

2 legs

4 legs

This way?


Multiple generalization

Multiple Generalization

Animal

Herbivore

Carnivore

Two Legged

Four legged

Dog


Subclass partitioning

Subclass Partitioning

  • Disjoint vs. Overlapping

    • Based on mutually exclusive subgroups

  • Incomplete vs. Complete

    • Coverage of the entire set

Powered Vehicle

ANIMAL

Disjoint and incomplete

Overlapping and complete

Plane Car Truck

Herbivore Carnivore


Relationships between classes

Relationships Between Classes

  • Associations

    • Objects are linked

    • Classes are associated

    • Represented as

(a link)

SU: University

David: Student

University

Student

(an association)


Multiplicity

Multiplicity

  • Sometimes called the “cardinality”of a relationship

  • The number of instances of each class that are or can be involved in a given association

1

University

Student

*


Other examples

Other Examples

*

Driver

Bus

*

*

Customer

Product

*

*

Student

Course

*

1

Advisor

Student

*


Roles and multiplicity

Roles and multiplicity

1

University

Student

*

0..1

University

Teacher

*

May be replaced by..

teacher

employer

*

0..1

University

Person

1

*

student


An example

An example

Aggregation (composed of..)

COMPANY

located

OFFICES

DEPARTMENT

Address: Stringvoice: number

Name: Name

constraint

association

*

*

roles

{subset}

generalization

member

1..*

manager

1

PERSON

HEADQUARTERS

Name: NameempID: IntegerTitle: String

interface

Getphoto()

Getsound()

Getcontact()

Getpersrec()

PersonnelRecord

taxId: string

Salary: currency


Generalization vs aggregation

Generalization vs. Aggregation

  • Can sometimes be confusing

  • Distinction can be made based on verb used

  • Generalization

    • The phrase: “IS A KIND OF…”

    • “A car is a kind of vehicle”

  • Aggregation

    • The phrase: “HAS A/AN…”

    • A car has an engine


An example1

An Example

BURNING LAMP

LAMP

ELECTRIC LAMP

BASE

WIRE

SWITCH

INCANDESCENT

FLOURESCENT

SOCKET

BULB


  • Login