CH06: Considering Objects TECH Computer Science Set, Class, Type …of… Objects, Actors, Agents...
-
Upload
lucinda-lloyd -
Category
Documents
-
view
217 -
download
0
Transcript of CH06: Considering Objects TECH Computer Science Set, Class, Type …of… Objects, Actors, Agents...
![Page 1: CH06: Considering Objects TECH Computer Science Set, Class, Type …of… Objects, Actors, Agents Data and Actions Object-Oriented Design and Development.](https://reader036.fdocuments.in/reader036/viewer/2022082506/56649eda5503460f94be9a36/html5/thumbnails/1.jpg)
CH06: Considering Objects
TECH Computer Science
Set, Class, Type…of…
Objects, Actors, AgentsData and Actions
• Object-Oriented Design and Development• Intro to UML (Unified modeling Language)
Diagrams
CH01
![Page 2: CH06: Considering Objects TECH Computer Science Set, Class, Type …of… Objects, Actors, Agents Data and Actions Object-Oriented Design and Development.](https://reader036.fdocuments.in/reader036/viewer/2022082506/56649eda5503460f94be9a36/html5/thumbnails/2.jpg)
Class vs. Object
• A class is a collection, a group, a set, or a type of …e.g.PeopleStudent
• An object is an instance or an individual of a classe.g.People TomStudent Marry
![Page 3: CH06: Considering Objects TECH Computer Science Set, Class, Type …of… Objects, Actors, Agents Data and Actions Object-Oriented Design and Development.](https://reader036.fdocuments.in/reader036/viewer/2022082506/56649eda5503460f94be9a36/html5/thumbnails/3.jpg)
Class and its UML Box
• DataState, attributes
• BehaviorAction, transformation, operation
Triggered by receipt of particular message, or entrance into a particular state
![Page 4: CH06: Considering Objects TECH Computer Science Set, Class, Type …of… Objects, Actors, Agents Data and Actions Object-Oriented Design and Development.](https://reader036.fdocuments.in/reader036/viewer/2022082506/56649eda5503460f94be9a36/html5/thumbnails/4.jpg)
Relations between Classes
• Subclasse.g.People
Student
• Hierarchy• Inheritance (is-a)
![Page 5: CH06: Considering Objects TECH Computer Science Set, Class, Type …of… Objects, Actors, Agents Data and Actions Object-Oriented Design and Development.](https://reader036.fdocuments.in/reader036/viewer/2022082506/56649eda5503460f94be9a36/html5/thumbnails/5.jpg)
Association relation between classes• Public Class Employee
• {
• public String lastName;
• …
• public Address homeAddress;
• …
• }
• Public class Address
{
…
}
Employee
-lastName : String
…
Address
-homeAddress
![Page 6: CH06: Considering Objects TECH Computer Science Set, Class, Type …of… Objects, Actors, Agents Data and Actions Object-Oriented Design and Development.](https://reader036.fdocuments.in/reader036/viewer/2022082506/56649eda5503460f94be9a36/html5/thumbnails/6.jpg)
Association relation between classes (bidirectional)• Public Class Team
• {• LinkedList members = new LisnkedList();
•
• …
• }
• Public class member
{
Team memberOf;
…
}
Team
Member
![Page 7: CH06: Considering Objects TECH Computer Science Set, Class, Type …of… Objects, Actors, Agents Data and Actions Object-Oriented Design and Development.](https://reader036.fdocuments.in/reader036/viewer/2022082506/56649eda5503460f94be9a36/html5/thumbnails/7.jpg)
Composition and Aggregation
![Page 8: CH06: Considering Objects TECH Computer Science Set, Class, Type …of… Objects, Actors, Agents Data and Actions Object-Oriented Design and Development.](https://reader036.fdocuments.in/reader036/viewer/2022082506/56649eda5503460f94be9a36/html5/thumbnails/8.jpg)
Dependency
• A dependency exists between the two if a class uses another class in some fashion
![Page 9: CH06: Considering Objects TECH Computer Science Set, Class, Type …of… Objects, Actors, Agents Data and Actions Object-Oriented Design and Development.](https://reader036.fdocuments.in/reader036/viewer/2022082506/56649eda5503460f94be9a36/html5/thumbnails/9.jpg)
Using Class Diagram to show a design
![Page 10: CH06: Considering Objects TECH Computer Science Set, Class, Type …of… Objects, Actors, Agents Data and Actions Object-Oriented Design and Development.](https://reader036.fdocuments.in/reader036/viewer/2022082506/56649eda5503460f94be9a36/html5/thumbnails/10.jpg)
More UML diagrams
![Page 11: CH06: Considering Objects TECH Computer Science Set, Class, Type …of… Objects, Actors, Agents Data and Actions Object-Oriented Design and Development.](https://reader036.fdocuments.in/reader036/viewer/2022082506/56649eda5503460f94be9a36/html5/thumbnails/11.jpg)
Use case diagram
![Page 12: CH06: Considering Objects TECH Computer Science Set, Class, Type …of… Objects, Actors, Agents Data and Actions Object-Oriented Design and Development.](https://reader036.fdocuments.in/reader036/viewer/2022082506/56649eda5503460f94be9a36/html5/thumbnails/12.jpg)
Activity Diagram
![Page 13: CH06: Considering Objects TECH Computer Science Set, Class, Type …of… Objects, Actors, Agents Data and Actions Object-Oriented Design and Development.](https://reader036.fdocuments.in/reader036/viewer/2022082506/56649eda5503460f94be9a36/html5/thumbnails/13.jpg)
State Diagram
![Page 14: CH06: Considering Objects TECH Computer Science Set, Class, Type …of… Objects, Actors, Agents Data and Actions Object-Oriented Design and Development.](https://reader036.fdocuments.in/reader036/viewer/2022082506/56649eda5503460f94be9a36/html5/thumbnails/14.jpg)
Sequence Diagram
![Page 15: CH06: Considering Objects TECH Computer Science Set, Class, Type …of… Objects, Actors, Agents Data and Actions Object-Oriented Design and Development.](https://reader036.fdocuments.in/reader036/viewer/2022082506/56649eda5503460f94be9a36/html5/thumbnails/15.jpg)
Collaboration Diagram
![Page 16: CH06: Considering Objects TECH Computer Science Set, Class, Type …of… Objects, Actors, Agents Data and Actions Object-Oriented Design and Development.](https://reader036.fdocuments.in/reader036/viewer/2022082506/56649eda5503460f94be9a36/html5/thumbnails/16.jpg)
Package Diagram
![Page 17: CH06: Considering Objects TECH Computer Science Set, Class, Type …of… Objects, Actors, Agents Data and Actions Object-Oriented Design and Development.](https://reader036.fdocuments.in/reader036/viewer/2022082506/56649eda5503460f94be9a36/html5/thumbnails/17.jpg)
OO Design
• Identify classesA set of objects sharing a common structure and
common behaviorsLooking for Things (nouns)
StructuresExternal systemsDevicesRolesOperating proceduresPlacesOrganizationsThings that are manipulated by the system to be builds
BehaviorsVerbs
![Page 18: CH06: Considering Objects TECH Computer Science Set, Class, Type …of… Objects, Actors, Agents Data and Actions Object-Oriented Design and Development.](https://reader036.fdocuments.in/reader036/viewer/2022082506/56649eda5503460f94be9a36/html5/thumbnails/18.jpg)
OO Measurement: MetricTable 6.7: Where to capture OO metrics.
Phase
Metric
Use cases Classdiagrams
Inter-actiondiagrams
Class descrip-tions
Statediagrams
Packagediagrams
Number of scenario scripts XNumber of key classes XNumber of support classes XAverage number ofsupport classes per keyclass
X
Number of subsystems XClass size X XNumber of operationsoverridden by a subclass
X
Number of operationsadded by a subclass
X
Specialization index XWeighted methods in class XDepth of inheritance XNumber of children XCoupling between objects XResponse for a class XLack of cohesion inmethods
X
Average operation size XAverage number ofparameters per operation
X
Operation complexity XPercent public andprotected
X
Public access to datamembers
X
Number of root classes XFan-in/fan-out X