Professional Documents
Culture Documents
Major Topics
Object-oriented programming concepts Object-oriented terminology Five-layer model CRC Cards Unified Modeling Language Use case and other UML diagrams Relationships
Kendall & Kendall
Copyright 2002 by Prentice Hall, Inc.
22-2
Object-Oriented Overview
Object-oriented techniques work well in situations where complicated systems are undergoing continuous maintenance, adaptation, and design There are two ways to model objectoriented systems
Coad and Yourdon methodology The Unified Modeling Language
Kendall & Kendall
Copyright 2002 by Prentice Hall, Inc.
22-3
Object-Oriented Programming
Six ideas characterize object-oriented programming:
An object, which represents a real-world thing or event A class, or group of related objects Messages, sent between objects Encapsulation, only an object makes changes through its own behavior
Kendall & Kendall
Copyright 2002 by Prentice Hall, Inc.
22-4
Object-Oriented Programming
Six ideas characterize object-oriented programming (continued):
Inheritance, a new class created from another class Polymorphism, meaning that a derived class behavior may be different from the base class
22-5
Terminology
Class refers to a template for a group of individual objects with common attributes and common behavior The difference between an Object and a Class is that the class defines shared attributes and behaviors of objects An object is an instance or occurrence of a class
Kendall & Kendall
Copyright 2002 by Prentice Hall, Inc.
22-6
Terminology
Another name for property is attribute Another name for method is operation Interface means the behavior of a class or component that is noticeable from outside the class or component
22-7
Encapsulation
Encapsulation changes the manner in which data is updated by programs because data can only be changed via the services that encapsulate the data
22-8
Inheritance
The two types of classes are involved in any inheritance relationship are the base class and the derived class Multiple inheritance means there will be multiple occurrences of the base type of class in the inheritance relationship Polymorphism only occurs where there is inheritance
Kendall & Kendall
Copyright 2002 by Prentice Hall, Inc.
22-9
Five-Layer Model
Object oriented analysis and design is based on a five-layer model:
Class/object layer notes the classes and objects Structure layer captures various structures of classes and objects, such as one-tomany relationships and inheritance Attribute layer details the attributes of classes
Kendall & Kendall
Copyright 2002 by Prentice Hall, Inc.
22-10
Five-Layer Model
Five-layer model, continued
Service layer notes messages and object behaviors Subject layer divides the design into implementation units or team assignments
22-11
22-12
22-13
22-14
22-15
22-16
Instance Connections
Instance connections are references between objects such as associations or relationships indicated by a single line between objects using the same cardinality notation as Whole-Part structures
22-17
Methods
Services (or methods or procedures) must be analyzed. Activities are
Object state analysis, showing changes of state Service specification: creating, storing, retrieving, connecting, accessing, and deleting objects Message specification, consisting of control and data flow
Kendall & Kendall
Copyright 2002 by Prentice Hall, Inc.
22-18
22-19
22-20
CRC Cards
Class, responsibilities, and collaborators (CRC) cards are used to represent the responsibilities of classes and the interaction between the classes
22-21
22-22
22-23
22-24
22-25
Use Case
A use case describes three things:
An actor (user) that initiates an event An event that triggers a use case The use case that performs the actions triggered by the event
22-26
22-27
22-28
22-29
22-31
22-32
22-33
Components, which are a physical part of a system that represents the services and interfaces implemented by the elements contained within that component, including software code
Kendall & Kendall
Copyright 2002 by Prentice Hall, Inc.
22-34
22-35
Behavioral Things
Behavioral things consist of
Interactions, or messages sent between a set of objects within the system to perform a specific task State machine, a series of states that an object goes through in response to actions within the system
22-36
Packages
Packages are groups of things They can be physical subsystems
22-37
Types of Relationships
There are two types of relationships that hold things together:
Structural Behavioral
22-38
22-39
22-40
22-41
22-42
22-43
22-44
Behavioral Diagrams
Behavioral diagrams describe the interaction between people and a use case
22-45
Behavioral Diagrams
Behavioral Diagrams include
Use case diagrams, showing the actors and the use cases Sequence diagrams that depict a succession of interactions between object instances over time and they show the processing described in use case scenarios Activity diagrams show the flow of activities within a process
Kendall & Kendall
Copyright 2002 by Prentice Hall, Inc.
22-46
Behavioral Diagrams
Behavioral Diagrams, continued
Collaboration diagrams illustrate a sequence of object interactions showing the organization of the objects during the interactions State chart diagrams show the states of an object and the events and conditions that trigger a transition from one state to another
Kendall & Kendall
Copyright 2002 by Prentice Hall, Inc.
22-47
22-48