Title: GRASP:????????
1GRASP????????
2??
3UML?????
- ????????????????????????(???UML???????)?
- ??GRAPS???GoF?????????????
4?????????
- ??????????????????,??????????,??????????
- ????(Classifier)???????
- ?????
- ??(doing)
- ??(knowing)
5?????????
- ????
- ?????????,????????
- ????????
- ?????????????
- ????
- ??????????
- ????????
- ???????????????
6GRASP
- General Responsibility Assignment Software
Patterns - ??????OO???????
- ???????????,??????,???,?????????????
7???GRASP?UML??????
- ??????????????????????????????
8?????(pattern)
- ?????????,??????????????????
- ???????
- ??
- ??
- ????
- ???????,????????(??)???????
- ?????????????,??????,???????????????????
9???????
10???
- ??
- ???????,?????????,??????
- ????
- ????????????????
11???(cont)
- ?????
- ????????????????????????????
- ??????????????????
- ????????
- ?????????
- ???????
- ????
12??? Example
- ????????Payment???,?????Sale?????????????
Payment
Register
Sale
13??? Example (cont)
makePayment()
1create()
Register
pPayment
Sale
2addPayment(p)
makePayment()
1makePayment()
Register
Sale
1.1create()
Payment
14??? Discussion
- ??????????????????,??????????????
- ????????????,?????????
15??? Discussion (cont)
- ???????????????????
- ????????????????????????
- ???,??????????????????????????????,???????????
- ???????????,?????????????????????????????
- ????????????????????????????
16??? Discussion (cont)
- ??
- ???????????
- ??????
- ????
- ????????
17????????
- TypeX ?TypeY???
- TypeX??TypeY???
- TypeX????????TypeY,??????,??,???????TypeY????
- TypeX? TypeY???.
- TypeY???,TypeA??????
18?????
- ???????????????????.??,J2EE???????????Java?(java.u
til)??,??Java???????????
19???
- ??
- ?????????????????????,?????????
- ????
- ??????????????
- ??????????????????
- ????????????????,??????
- ????
- ????
- ????
- ?????????
20??(???)
21??(???)
22?????????
- ?????????????????????????????
- ????????????????????????
- ??????????????????????,????????????
- ?????????????????,?????????????,??????????
23????????
24??????????
- ?????????????????,?????????????????
- ?????????????
25??
- ??????????????
- ??????????
- ???????
- ?????
26???
- ????????????????
- ????????????????,????A?????????B
- B?????A
- B??A???????
27?????
- ????????
- ?????????????????????Sale?Payment
- ????????,??????????????????????
28???
- ???????????????,????????????????(?????)??
- ??
- ?????
- ????
- ???
- ?????????
- ??-??(????)
29???? (Information Expert)
- ??
- ????????????????
- ????
- ??????????,??????????????
30???? (Information Expert)
Sale
date time
Contains
ProductDescription
description price UPC
1..
SalesLineItem
quantity
Described-by
31???? (Information Expert)
- ?????????????
- SalesLineItem ? Sale??.??????SalesLineItem ??????
- ??Sale?????
- ?????
32???? (Information Expert)(cont)
- ?????SalesLineItem????
- ????? SalesLineItem.quantity ????ProductSpecifica
tion.price - ????????,???SalesLineItem????SalesLineItem???
? ??
Sale ??????
SalesLineItem ??????
ProductSpecification ??????
33???? (Information Expert)(cont)
34???? (Information Expert) ??
- ?????????????
- DIY Do It Yourself
35???? (Information Expert) ??
- ??????
- ?????????????????
- ?????,????????,?????
- ??????????????
- ??????????????,????????????
- ???????
36???? (Information Expert)??
- ?????,????????????,???????????
- ??,????Sale??DB?
37???
- ??
- ????????????
- ????
- ?????????????
- ?????????? ???
- ????????,??????????????? (use-case controller)
- ?????????????????????????
- ?????UI???????
38???(cont)
- ????
- ???????????
- ??????UI??,???Window/View??????UI??UI?????????????
?,??????????? - ????????
39????
40????
41??? Example
- ?????????(???????),?????????,??? System???
- ??,????????????System??????
- ???????????????????????????
System
endSale() enterItem() makePayment() ..
42??? Example (cont)
???????? Register
????????? ProcessSaleHandler
43??? Example (cont)
????????????????????
44??????Façade Controller
- ??????
- ? Register, RetailInformationSystem, Switch,
Router, NetworkInterfaceCard etc. - ???????
- ?????????
45??????Use Case Controller
- ??????????????????????????
- ???
- ??????????????????(????????)
- ???????????????
46??
public class EnterItemAction extends
Action public ActionForward execute(
ActionMapping mapping,
ActionForm
form...) Repository repository
..... Register register repository.getRegiste
r() String txtId ((SaleForm)form).getItemI
D() String txtQty ((SaleForm)form).getQuantit
y() ItemID id Transformer.toItemID(txtID)
int qty Transformer.toInt(txtQty) regis
ter.enterItem(id,qty)
47?????
- ????????????????
- ??????????????
- ?????????
- ?????????????????
48??? ??
- ?????? (windows, applets)??????????????
- ??????????????
onEnterItem()
onEnterItem()
SaleJFrame
SaleJFrame
1enterItem()
1makeLineItem()
2makeLineItem()
Register
Sale
Sale
49????