Title: Object Oriented Programming
1????
????
4
UML??????? ??? ???? ??? ?????
2UML??????? ??? ???? ??? ?????
3UML Unified Modeling Language
- Language ??? (??????)
- Modeling ????? ?????? ?? ????? - ??? ?? ??
????? - Unified ??????. ????? ????? ??????? ?????
??????? ??????? ?????, ????? ??????-?????, ??????
????? ????.
4???? ???????
- ???? ??? ??? ????? ?????? ????? ??????.
??? ????? ???
5???? ???????
- ???? ??? ??? ????? ?????? ????? ??????.
????? ???? ???? ?????
6???? ???????
- ???? ??? ??? ????? ?????? ????? ??????.
class Car public int GetNumber ()
return Number private int Number )
Car
Number integer
???? ?????UML????
7???? ???????
- ???? ??? ??? ????? ?????? ????? ??????.
Car
Number integer
???? ????UML????
8UML ????? ?????
- ???? UML ???? ???? ??? ???? ?? ???? ??????
??????.
class Car public int GetNumber ()
return Number private int Number
)
Car
Number integer
????
??????
?????
9?????? ????? ?????
- ????? ?????? ?????? ????? ???????.
class Car public int GetNumber ()
return Number private int Number
)
??????
?????
10UML ????
- UML ??? ??? ??? ?? ????? ????? ???? ?????
- ?- UML ?? ???? ????? ??? ???? ??????
- ?????
- ?????? "???? ?????? ???? ?????? ???? ????.
??????? ??????, ?? ???? ????? ????? ????? ????
????" - UML ??? ??? ??????.
120
????
??? ????
11??????? ?? ??????? ?
.
- ?? ????? ?????? ?
- ????? ? "???? ???? ?????"
- ???? ?????? ? "?????? ????? ????? ??????? ??????"
- ??????? ? "?? ?? ??? ?? ???? ????? ????"
- ?????? ???? ? "?????? ???? ????? ?????? ?????"
- ??? ???? ? "?? ?? ??? ???? ???? ?? ?????
????? ???"
?? UML
???
????
?? UML
12 UML ??? ??????
- ?- UML ??? ??? ??? ?? ?????? ??? ??? ?? ???????
??? ?????? ????. - ??? ????? PASCAL ?? ????? ?????? ????? ?????
?????? ????? ????? ?? ??? ???? ?? ?? UML. - ???? ?????? ????? ?? ?????? ?????? ?????
13?????? ????? ?????? ?????
- ?- 1986 ????? ???? ???? ??? ???? ??? ?????? ?????
THERAC-25 ?????? ???? ????? ??????? ??????? ??
?????, ?? ??? ??????, ?????? ????? ?????. - ???? ???????? ?? ???? ????? ????? ?- 1991 ????
???? ?????? ?? ????? ???? ??????? ?????, ??? ????
????? ?????? ?????? ???? ??????? ?? 678 ???
?????? ????? ????? ??????.29 ??? ????? ?- 97
????? ?????? ???? ??????.
14?????? ????? ?????? ?????
- ?- 1999 ??? ???? ??? ?? NASA ?????? ?????? ????
???? ?????? ????? - Mars Climate Orbiter ????? ?? ???? ?????? ??????
????? ?? 170 ?"? ?????? ????? ?????? ??????
?????? ?????? ?? ????? ?????? - Mars Polar Lander ???? ??? ????? ???????. ?????
???? ??? ??? ????.
15Ariane 5
- 4 ????? 1996 ????? ?????? ?? ???? Ariane 5 .
- 40 ????? ???? ?????? ????? ?? 3700 ???, ???? ???
???????, ????? ???????. - ????? ???? ??? 10 ???? ???? 8 ??????? ????.
- ???? ?????, ??? ??? ?????, ??? ??? ??????? ????.
16????? ????????? ?????? ???
- ???????? ??????? ?????? ?????? ????? ?????, ????
?????? ?????? ?????? ??????. - ???? ????? ?????? bh(Horizontal Bias) ?????
??????? ??????? ?? ????, ???? ??? ???? ??????
???? ?????? ????? ?????? ?????? ???.
double d_bh short s_bh sense_horizontal_velocity
(d_bh) s_bh d_bh // OPERAND ERROR
17 UML ??? ??????
- ????????? UML ???? ????? ??????, ?????? ??????
???? ???? ????? ????? ! - "????? ??????" ???? ?????? ?? ???? ?? ?????,
????? ????? ????? ??????? ?? ??????. - Rhapsody, ??? ?????? ????? I-Logix ???? ?????
??? ?- UML ??? ???? ????? ??????. - ???? ?????? ??????? ??????
18?????? ?- UML
- Class diagrams
- ???? ?????? ???????
- State diagrams
- ????? ??????? ??????
- Sequence diagrams
- ??? ??????? ????
- ????
19UML Class Diagram
??????
????
4
???
1
????
1
- ?????? ?????? ?-4 ??????, ??? ?????
20UML Class Diagram
- "??? ????" ?"????? ?????" ?? ????? ?? ???????
??????
??? ????
????? ?????
21UML State Diagram
??????
go()
?????
?????
stop()
- ??????? ??? ????? ?? ???? ????? ?? ???? ?????.
?????? go() ?- stop() ?????? ??????? ?? ???????
???? ????.
22UML Sequence Diagram
- ??? ??????? ?????? ??????
- ????
- ????? ?????
- ????? ??????
- ????
Car
go()
releaseBreak()
driver
engageGear()
accelerate()
23????? ?- UML ?????? ?????
- ????? ???? ?????? ???? ????? ?????
- ????? ???? ?? ??????
- ????? ????
class Car public int GetNumber ()
return Number private int Number
)
24?????
25????? ??????
- ??? ???????? ?????? ????? ??? ??? "????"
(Cohesion) ?? ???????? ?? ???????. - ???? ??? ???? ????? ?? ???????? ?????? ?????? ??
???. - ??? ??? ???? ???? ?????? ???? "????".
- ???? ????? ??? ???? ????? ??? ???? ?? ?????? ??
?? ??????, ????? ???? ????? ????? ?? ?? ?? ?????
?? ????? ?????. - ???? ???????? ???????? ?- UML ???? ?????? ??
??????? "?????"
26????? "????"
Car
- ?????? ????? ??????? ??? ??? ??? ??? ??????.
OwnerName string IsurancePremium float
PayInsurance(sum float) ChangeOwner (name
string)
. . .
27?????? "?????"
1
0..1
InsurancePolicy
Car
YearlyPremium float
Number Integer
. . .
InsurancePolicy(CarNumber) PayInsurance (sum
float)
. . .
28?????? ??????
????? ???? ?? ??????
??????
????? ?????
???
?????
?????
- ????? ?????? ??? ?????? UML ??????? ????? ????
????? ????? ????? ??? ?????
29?????? ??????
????? ???? ?? ??????
??????
????? ?????
???
?????
?????
- ????? ?????? ??? ?????? UML ??????? ????? ????
????? ????? ????? ??? ?????
30?????? ??????
?????
?????
- ????? ?????? ??? ?????? UML ??????? ????? ????
????? ????? ????? ??? ?????
31?????
- UML ??? ?????? ?????? ?? ???? ????????.
- UML ??? ???????.
- ?- UML ????? ?? ????? ??? ??????.
- ?- UML ??????? ????? ????? ?? ????????, ?????-
class diagram ????? ?????? ??????? ??????. - UML ????? ?? ?????? ??? ????? ??? ?????? ???????
????? ?????.
32(No Transcript)