Class Diagram - PowerPoint PPT Presentation

About This Presentation
Title:

Class Diagram

Description:

OOAD. Object Oriented Analysis . ... Unique Identity Object Class ... – PowerPoint PPT presentation

Number of Views:149
Avg rating:3.0/5.0
Slides: 27
Provided by: uyarijFil
Category:

less

Transcript and Presenter's Notes

Title: Class Diagram


1

Object Oriented Analysis And Design
  • 8311302 ??????????????????????????????
  • Class Diagram

2
???????? Attributes ??? Methods ??? Class
  • Attributes
  • ???????????????? Unique Identity ??? Object ???
    Class ???? ??????????????????? ???????????????????
    ????????? ?????? ISBN ???????????????????
  • ????????????????????????????? ????????????????????
    ????????? ???Class ???? ???????????????? ?
    ??????????????
  • ????????????????????????????? ?
    ???????????????????????????????? ????????????????
    Class ????????????????????????????????????????????
    ???????????????????????? ???? ????????????????
    ?????????? ????????????????? ?????????????????????
    ?
  • ????????????????????????? Class ????
    ???????????????????????????? ?????????????????????
    ?

3
Method
  • ?????? Method ???????????? (Verb)
    ?????????????????
  • ????? Method ??? Class ??? ???? Object
    ???????????

???????? ????????????????????????????????????????
?????????????????????????????????????????????????
???-???????????????????? ?????????????????????????
?? ?????? ???? ??????????????? (??????)
?????????? ?????? ????????????????????????????????
????????????????????????? ????????????????????????
? ???????????????? ????????????????????????? 1 ??
??????????????????????????????????????? 20 ???
4
Encapsulation
  • ??? ?????????????????????????????????????????????
    ??????????????????????????? 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 ?????????

5
Information 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()

9
Association
  • ?????????????????????????????????????
    ??????????????????????????????????????????????????
    ????????????????????????? ??????????????????????
  • ???? ???????????????????, ????????, ????????????,
    ????????????????????????
  • ?????????????????????????????????
    ????????????????? ?????????????????????????
    Association ?????????? ???????? (works at)
  • ??????????????????????? ?? ????? ????????????

Multiplicity ??????????????????????????????????
Class ?????? ?????????????? Association ????
????????????????????????????? Class
???????????? ?? Association ??????? Multiplicity
10
Multiplicity
  • ???????????????????????????????????????? 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
  1. One-to-one Association (1-1) ??? Association ???
    Class ?????????????? Association ?? Max-card ????
    1 ???????
  2. One-to-many Association (1-M) ??? Association ???
    Class ???????????? Association ?? Max-card ???? 1
    ???????? Class ?????????????? Max-card
    ??????????????? 1
  3. Many-to-many Association (M-N) ??? Association
    ??? Class ?????????????? Association ?? Max-card
    ??????? 1 ???????

14
Aggregation
  • 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
??????????????????
  1. ????????? (ClassRoom) ???????????????????????????
    (Student) ???????????????? ?????????????
    (Teacher) ??????? ????????????????
    (TeachingMaterial) ??????????????????????????
  2. ?????????? ???????????????????????????????? ? ????

18
Composition
  • ??????????????????????? ?? 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) ??????????

21
Generalization
  • ?????????????????????????????? ?????????
  • ???? ???????????????????? (???)
    ????????????????????? (????) ???? Aggregation ???
    Association ????????????????????
    ???????????????????????????????? ?????????? ???
    ???? ????????? ??????????????????
    ????????????????? Generalization
    ?????????????????? ?????????
  • ?????????
  • ???????? ???????? (Sport Car) ???????????????????
    Turbo ????????????????????????????????
    ????????????????????

??????
Specialize
Generalize
????????
22
???????? ????????? Generalization ???? UML
?????? 2 Generalization ??? Animal
?????? 1 Generalization ??? Car
23
Inheritance ??? 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
??????????? ???????????????????????????????
25
Multiple Inheritance
  • ??? ??????????????????????????????????????????????
    ????????????????????????????????????????????
  • ???? ?????????????????????????????????
    (ComboPlayer) ?????????????????????????????
    (AudioPlayer) ???????????????? (VideoPlayer)

Class VideoPlayer ?? Method playVideo ????
Class AudioPlayer ?? Method playAudio ????????
? Class ??????????????????????????????? ComboPlaye
r ??????????????????????????? ??? ???????????
?????????? ComboPlayer ??????????? Method
changePlayMode ?????????????????? ?????????
ComboPlayer ??????????????? (?????? ??????????????
????)
26
Thank You !
Write a Comment
User Comments (0)
About PowerShow.com