Title: Class Diagram
1Object Oriented Analysis And Design
- 8311302 ??????????????????????????????
- Class Diagram
2???????? Attributes ??? Methods ??? Class
- Attributes
- ???????????????? Unique Identity ??? Object ???
Class ???? ??????????????????? ???????????????????
????????? ?????? ISBN ??????????????????? - ????????????????????????????? ????????????????????
????????? ???Class ???? ???????????????? ?
?????????????? - ????????????????????????????? ?
???????????????????????????????? ????????????????
Class ????????????????????????????????????????????
???????????????????????? ???? ????????????????
?????????? ????????????????? ?????????????????????
? - ????????????????????????? Class ????
???????????????????????????? ?????????????????????
?
3Method
- ?????? Method ???????????? (Verb)
????????????????? - ????? Method ??? Class ??? ???? Object
???????????
???????? ????????????????????????????????????????
?????????????????????????????????????????????????
???-???????????????????? ?????????????????????????
?? ?????? ???? ??????????????? (??????)
?????????? ?????? ????????????????????????????????
????????????????????????? ????????????????????????
? ???????????????? ????????????????????????? 1 ??
??????????????????????????????????????? 20 ???
4Encapsulation
- ??? ?????????????????????????????????????????????
??????????????????????????? Class
??????????????????????? ???????????? ?????? Class
??????????? Class ??? ????????????????????????
Class ???????????????????? ???????????????????????
? Public Interface - ??????? Encapsulation ???????????????????? Class
??????????????? - ?????? Class ????????
- ?????? Class ??????????? Class ???
???????????????? ???? Attributes ??? Methods
?????????? Class - ?????? Class ?????????
- ?????????????????? Class ????????????????????????
Public Interface ???????? ?????????????????????
Class ??????????????????????????????? Class ???
?????????? Information Hiding ????????????????????
??? Attributes ??? Methods ??? Class ?????????
5Information Hiding
- ????????????????????? (Attributes, Methods) ???
Class ?????????? ?????????????????????????????????
?? ? ????????? Class ??????????? Visibility
??????????? 3 ????? ??? - Private ??? Attributes/Methods ???????????????
Private ????????????????????????
??????????????????????????????????
?????????????????????????????? Class ??? - Protected ??? Attributes/Methods ???????????????
Protected ????????????????????????
??????????????????????????????????
?????????????????????????????? Class ??? ????
Protected Attributes/Methods ????????????????????
Subclass ??????????????????????????? Subclass - Public ??? Attributes/Methods ??????????????????
Public ???????????????????????????????????????????
???????????????? ????????????????????????????
Subclass ???????
6????????
- ???????????? Class ReaderCounter
??????????????????????????????????????????????????
??? ??????????? ReaderCounter ???????????
???????????????????? ?????????????????????????????
????? ??? ReaderCounter ??????????????????????????
????????????????????????? ????????????????????????
??????? (???????????????????????
??????????????????????????????????????????????) - ??????????? 1 ??????? Class ReaderCounter ?????
Public Attribute count ?????????????????????????
????????? ??????????? count ??????????????????????
???????????????? - ??????????? 2 ??????? Class ReaderCounter ?????
Private Attribute count ????????????? Public
Method enterCount ??? exitCount
????????????????????? count ?????????????
?????????? count ??????????? ????????
7??????????????? Class, Attributes ??? Method
- ??????? Class, Attribute ??? Methods
?????????????????????????? ????????????????????
Class, Attribute ??? Methods ?????
??????????????????????????????????????????????????
??????????????????????? ???? ?????????????????????
??? ???????????????????? - ???? ???????? Class ??????????????????????????
(Member Card) ??? MemberCard - ???? Class ???????????????????????????????????????
????? - ???? ReaderCounter
- ???? Methods ???? Attributes ?????????????????????
???????????????????? - ???? memberCardId, enterCount()
8??????????????? Class, Attributes ??? Method (???)
- ???? Methods ????????????????? Attributes
??????????????????? set ???????????????
Attribute ???????????????????????????????????? - ???? Methods ????????????????? Attribute
memberCardId ???????????? setMemberCardId - ???? Methods ???????????????? Attributes
??????????????????? get ???????????????
Attribute ???? ???????????????????????????????? - ???? Method ???????????????? Attribute
memberCardId ???????????? getMemberCardId()
9Association
- ?????????????????????????????????????
??????????????????????????????????????????????????
????????????????????????? ?????????????????????? - ???? ???????????????????, ????????, ????????????,
???????????????????????? - ?????????????????????????????????
????????????????? ?????????????????????????
Association ?????????? ???????? (works at) - ??????????????????????? ?? ????? ????????????
Multiplicity ??????????????????????????????????
Class ?????? ?????????????? Association ????
????????????????????????????? Class
???????????? ?? Association ??????? Multiplicity
10Multiplicity
- ???????????????????????????????????????? Class
??????????????? Association ??? Minimum
Multiplicity (Min-card) - ?????????????????????????????????? Class
??????????????? Association ??? Maximum
Multiplicity (Max-card)
11????????
- ???????????????????????? (Member) ????????????
(Member Card) ??????????????? - ??????????????? (Book) ???????????????????????????
?????????? 1 ???????????? 5 ????
1
0..5
12????????
- ?????????????? (??????????????????????????????????
?) ???????? CD (Compact Disk) ????????????????????
???????????? ??????? CD ??????????????????????????
?? ???????????????????????????????????????????????
????????? CD ???????????????????????????????????
????????????????????? - ????????????????? ????????????????????????????????
???????????????????? (Media) ????????????? ????
??? ????????? ????? ??????????????????????????????
????????????????????????? ????????????????????????
???????????????????????????????????????????????
0 1
0 0
13???????????????????? Association
- One-to-one Association (1-1) ??? Association ???
Class ?????????????? Association ?? Max-card ????
1 ??????? - One-to-many Association (1-M) ??? Association ???
Class ???????????? Association ?? Max-card ???? 1
???????? Class ?????????????? Max-card
??????????????? 1 - Many-to-many Association (M-N) ??? Association
??? Class ?????????????? Association ?? Max-card
??????? 1 ???????
14Aggregation
- Aggregation ??? ??????????????????????????? Class
????????????????????? Class ??????????????????????
Class ????? - ??????????????????????????????????????????????????
??????????????????? ???? - ????????????????????? ????? ??? ?? ???
- ????????????????????????????????? Main Board,
Ram, Rom, Disk Drive, Case - ??? ?????????????????????? ??? ??? ?????
?????????????? ? - Aggregation ????????????????? ???? 2 ?????? ???
1-1 ??? 1-M ????????
15???????? Aggregation ???? UML
- ?????? (Car) ????????????????????? (Engine)
???????????????? ?????? (Body) ??????????? ??????
(Wheel) ????? 4 ??? ???????????????? (Boat)
?????????????????????????? ?????????? (Propeller)
??????????????? (Rudder) ??????????? UML
?????????
16???????? Aggregation ???? UML
- File ????????????????? Folder ????? Folder
?????????????????????? Folder ?????????
?????????????? File ????? File ?????
?????????????????????????
17????????????????? Aggregation ???? UML
??????????????????
- ????????? (ClassRoom) ???????????????????????????
(Student) ???????????????? ?????????????
(Teacher) ??????? ????????????????
(TeachingMaterial) ?????????????????????????? - ?????????? ???????????????????????????????? ? ????
18Composition
- ??????????????????????? ?? Aggregation ???
Building ???????? ClassRoom ???? ClassRoom
??????????????????????????????? Building ???? ???
Building ?????????????? ClassRoom
????????????????????????? - ?????????????????? Building ??????????????????????
???? ClassRoom ???? Aggregation
?????????????????? Aggregation ???????????
???????? Composition
19????????????????? Composition ???? UML
??????????????????
- ??????? (Book) ?????????? ????? (Cover)
?????????????????? ????????? (Perface)
??????????? (TableOfContent) ?????????????????
(Chapter) ???????????????????????????????
Composition ???????????????????????????? ?? ????
?????? ????????????????????????????????
20????????????????? Composition ???? UML
?????????????????? (???)
- ????? (Account) ????????????????? ????????
(AccountingGroup) ????????????????????????????
?????????????????? (AccountingItem) ??????????
21Generalization
- ?????????????????????????????? ?????????
- ???? ???????????????????? (???)
????????????????????? (????) ???? Aggregation ???
Association ????????????????????
???????????????????????????????? ?????????? ???
???? ????????? ??????????????????
????????????????? Generalization
?????????????????? ????????? - ?????????
- ???????? ???????? (Sport Car) ???????????????????
Turbo ????????????????????????????????
????????????????????
??????
Specialize
Generalize
????????
22???????? ????????? Generalization ???? UML
?????? 2 Generalization ??? Animal
?????? 1 Generalization ??? Car
23Inheritance ??? Visibility
- ????? Inheritance ????????????????? Visibility
??? Attributes/Methods ????????????????
Superclass ????? Subclass ????????????????????????
????????????????????? ??????????? - Public Attributes/Methods ??? Superclass
??????????????? Public Attributes/Methods ???
Subclass ???? - Protected Attributes/Methods ??? Superclass
?????????????????? Protected Attributes/Methods
??? Subclass ????? ?????????? Attributes ???
Methods ??? Subclass ????????????????????????
Superclass ??????? ??????? Method ??? ???
Subclass ???? ?????????????? Method
????????????????? Inherit ??????? - Private Attributes/Methods ??? Superclass
??????????????? Private Attributes/Methods
????????? ??????????????????????????? ???????
Method ??? Subclass ???????????????????????????
Superclass ?????????? Attributes/Methods
??????????????????????????????????????
??????????? Protected Methods ???? Public Methods
???????????????????????? Superclass ????????
24????????
???????????????????????? Inheritance ????????
Methods getAnimalType ??? setAnimalType ??????
?? Methods ?????????????????????????? animalType
??????????????? Private Attribute
??? ????????????????? Attribute animalBirthZone
??????????? ???????????????????????????????
25Multiple Inheritance
- ??? ??????????????????????????????????????????????
???????????????????????????????????????????? - ???? ?????????????????????????????????
(ComboPlayer) ?????????????????????????????
(AudioPlayer) ???????????????? (VideoPlayer)
Class VideoPlayer ?? Method playVideo ????
Class AudioPlayer ?? Method playAudio ????????
? Class ??????????????????????????????? ComboPlaye
r ??????????????????????????? ??? ???????????
?????????? ComboPlayer ??????????? Method
changePlayMode ?????????????????? ?????????
ComboPlayer ??????????????? (?????? ??????????????
????)
26Thank You !