SOLID Principles
-
Single Responsibility
- CityPair
- CityPairConverter rather than add convert method inside CityPair
-
Open for Extension, Closed for Modification
- Policy
- NfdPolicy extend Policy, add FareBasis field
-
Liskov Substitution
- Policy interface should not have getFareBasis method, because fdPolicy has no farebasis
- any implementation of an interface should not break our code, like throw UnsupportedOperationException
-
Interface Segregation
- Split BearKeeper into BearCleaner, BearFeeder and BearPetter
-
Dependency Inversion
- Computer-StandardKeyBoard, bad
- Computer-KeyBoard-StandardKeyBoard, good

浙公网安备 33010602011771号