Lec 9 Class Based Modeling
Lec 9 Class Based Modeling
Class-Based
Prof. Alex Bardas
Class-Based Modeling
• A class-based model contains
• Objects
• What the system will manipulate
• Operations (methods or services)
• What to be applied to the objects to effect the manipulation
• Relationships (some hierarchical) between objects
• Collaborations between the classes that are defined
homeowner role
The SafeHome security function enables the
homeowner to configure the security system when it (security) system thing
is installed, monitors all sensors connected to the sensor external entity
security system, and interacts with the homeowner control panel external entity
through the Internet, a PC, or a control panel.
homeowner role
During installation, the SafeHome PC is used to system thing
program and configure the system. Each sensor is
assigned a number and type, a master password is sensor external entity
programmed for arming and disarming the system, control panel external entity
and telephone number(s) are input for dialing when a
sensor event occurs.
homeowner role
During installation, the SafeHome PC is used to
program and configure the system. Each sensor is system thing
assigned a number and type, a master password is sensor external entity
programmed for arming and disarming the system,
control panel external entity
and telephone number(s) are input for dialing when a
sensor event occurs. Installation event
number, type thing
master password thing
telephone number thing
sensor event event
homeowner role
When a sensor event is recognized, the software system thing
invokes an audible alarm attached to the system. After
sensor external entity
a delay time that is specified by the homeowner during
system configuration activities, the software dials a control panel external entity
telephone number of a monitoring service, provides Installation event
information about the location, reporting the nature of
number, type thing
the event that has been detected. The telephone
number will be redialed every 20 seconds until master password thing
telephone connection is obtained. telephone number thing
sensor event event
homeowner role
When a sensor event is recognized, the software system thing
invokes an audible alarm attached to the system. After
sensor external entity
a delay time that is specified by the homeowner during
system configuration activities, the software dials a control panel external entity
telephone number of a monitoring service, provides Installation event
information about the location, reporting the nature of
number, type thing
the event that has been detected. The telephone
number will be redialed every 20 seconds until master password thing
telephone connection is obtained. telephone number thing
sensor event event
audible alarm external entity
delay time thing
monitoring service external entity
2. Needed services
3. Multiple attributes
4. Common attributes
5. Common operations
6. Essential requirements
Potential Class Type Class Selection Characteristics
homeowner role
system thing
sensor external entity
control panel external entity
Installation event
number, type thing
master password thing
telephone number thing
sensor event event
audible alarm external entity
delay time thing
monitoring service external entity
• CRC model:
• Used to identify and organize classes
• Originally introduced as a technique for teaching object-
oriented concepts
• Use a collection of (actual or virtual) index cards
representing classes
EECS 448 Software Engineering 23
CRC Modeling
• A CRC model - index cards represent classes
Class:
Class:
Description:
Class:
Description:
Class: FloorPlan
Description:
Responsibility:
Description: Collaborator:
Responsibility: Collaborator:
Responsibility: Collaborator:
Responsibility: Collaborator:
defines floor plan name/type
manages floor plan positioning
scales floor plan for display
incorporates walls, doors and windows Wall
shows position of video cameras Camera
• Information about one thing should be localized with a single class, not
distributed across multiple classes
• Avoid spreading across classes
• Encapsulation is good in testing and maintenance
<<access>>
{password}
dependency
Player Wall
composition association
1 1 1
type
name
outsideDimensions
determineType()
positionFloorplan()
scale()
changColor()
Is placed within
Is part of
Wall
type
Camera wallDimensions
type determineType()
ID computeDimensions()
location
fieldView Is used to build Is used to build
panAngle Is used
zoomSetting to build
determineType() WallSegment Window Door
translateLocation() type type type
displayID() startCoordinates startCoordinates startCoordinates
displayView() stopCoordinates stopCoordinates stopCoordinates
displayZoom() nextWallSegment nextWindow nextDoor
determineType() determineType() determineType()
draw() draw() draw()
Aggregation
is registered for>
Student Semester
g>
tak
rin
es>
du
ld
he
is
teaches> Class
Instructor
Section
is
<works for
ins
ta
nc
eo
f>
sponsors>
Department Course
Student Advisor
Major
is registered for>
Student Semester
1..*
0..* 1
g >
tak
rin
e s>
du
ld
he
0..8 1..*
is
teaches> Class
Instructor
1..3 0..6 Section
1..* is
<works for
in
sta
n ce
of
1 >
1 sponsors> 1..*
Department Course
Generalization
with a solid line with a hollow arrowhead.
Specialization
Student
Student
Person
major: String
name: String GPA: Real
address: String standing: String
Crust 1 1
1
1 1 *
Sauce Serving Pizza Order
1..3 1 1
Cheese Serving
0..9 1 4..*
Topping Serving
Slice
Room Building
Student
Prerequisite
add(Course)
drop(Course)
Characters
+Player
+Protagonist
+Antagonist
+SupportingRole
1
1 0..*
Managed By History Log
0..n
History Entry
Code Bug Report
-when : Date
-whatDone : string
• This slide set has been extracted and updated from the slides
designed to accompany Software Engineering: A Practitioner’s
Approach, 8/e (McGraw-Hill 2014) by Roger Pressman
61