Chap 1:
1.great software:client-friendly, flexibility: even if customer thinks new way to use their software, it still works
ood: each class controls it's own behavior
open to extension(flexible), close for modification
2. enum优点:
method or class use enums are protected from values outside of enum(value safety)
3. null-value properties: encapsulation guitar properties(guitarSpec) out of guitar
make sure we could add new properties to the app easily
functionality: keep 不变的地方与变的地方seperate
delegation:an object needs to do sth, it asks anthoer obj to handle.
例如,search guitar功能需要compare,让guitar自己compare-》guitarSpec来做compre
loosly coupled
Chap 2: Requirement
Chap 3: Requirement Change
requirements always change. eg not pressButton to open the dogDoor, but use a BarkRecognizer to recognize the bark
Chap 4: Analysis
1. use string to represent the bark, and compare string in recognizer with previously stored dog's bark in dogDoor
2. use Object bark and a equals method(delegation and loosely coupled) to tell bark to compare itself.
Thus, if we change the way bark compare(eg not string compare) we just need to change bark object not recognizer.
3. store a list of barks in dogDoor because the noun word is Dog not bark. A dog may have different barks. Normally the noun in use case are objects and verbs are methods.
But we don't use Dog as an object. REASON:
1.狗是external to 系统,You ususlly 不需要在系统中represent外部事物
2.狗不是software object。You usually 不represent 活物with a class
3.即使有Dog class,You 不能“store” a Dog in the dog door
Chap 5:
Encapsulation will protect your class from unnecessary changes
Encapsulate what varies, each class should only has one reason to change
没有评论:
发表评论