SmalltalkBestPracticePatterns:8.6

From 흡혈양파의 번역工房
Jump to navigation Jump to search
8.6 요약

위의 코드에서 사용한 패턴은 다음과 같다:

Pattern Example
Simple Superclass Name Money, MoneySum
Constructor Method MoneySum class>>monies:
Constructor Parameter Method MoneySum>>setMonies:
Common State, Role
Suggesting Instance
Variable Name
Money "currency"
Intention Revealing Selector Money>>+
Getting Method Money>>currency
Composed Method Money class>>amount:currency:
Decomposing Message Money class>>amount:currency:
sending #setAmount:currency:
Choosing Message addMoney:, addMoneySum:
Dispatched Interpretation,
Double Dispatch
Money>>addMoney:
Debug Print Method Money>>printOn:
Array MoneySum
Inline Message Pattern Money>>setAmount:currency:
Indented Control Flow Money>>addMoney:
Conditional Expression Money>>addMoney:
Rectangular Block Money>>addMoney:
Direct Variable Access Money>>addMoney:
Type Suggesting Parameter Name Money class>>amount: aNumber
currency: aSymbol
Simple Enumeration Parameter MoneySum>>printOn:
Interesting Return Value Money>>addMoney:


목록에서 볼 수 있듯이 아무리 간단한 코드라 하더라도 코드를 읽는 이와 통신하기 위해 많은 기법을 사용한다.


Notes