对象七个原则-实例
2019-07-18 10:01:48 7 举报
对象7原则 实例
作者其他创作
大纲/内容
Form3
Client
+ main(String ...args): void
AbstractSource
Form2
减法类
+ GetResult(): double
Dao3
图1
图2
UserDao
- db: DBUtil
+ findUser(String username): User
XMLTransformer
Dao4
StuDao
+ findStuById(String id): Stu+ findAllStu(): List
依赖倒转原则
DatabaseSource
客户端类
DBUtil
+ getConnetion(): Connection
迪米特法则
config.xml
ConcreteService
+ operatorA(): void+ operatorB(): void+ operatorC(): void
CipherA
+ encrypt(String plainText): String
+ getConnect(): Connection
CipherB
接口隔离原则
对象七个原则实例
MainClass
Association-关联
TeacherDao
+ findTeacherById(String id): Teacher+ findAllTeacher(): List
里氏代换原则
Dao1
ClientB
Aggregation-聚合
开闭原则
XLSTransformer
Form5
AbstractServiceA-interface
+ operatorA(): void
TextSource
单一职责原则
ClientA
DataOperator
- cipherA: CipherA- cipherB: CipherB
+ setCipherA(CipherA cipherA): void+ setCipherB(CipherB cipherB): void+ encrypt(String plainText): String
AbstractService-interface
ClientC
Form4
合成复用原则
Form1
Dependency-依赖
Realization[Implementation]-实现
Dao2
乘法类
NewDBUtil
Controller2
AbstractServiceB-interface
+ operatorB(): void
AbstractServiceC-interface
+ operatorC(): void
- cipherA: CipherA
+ setCipherA(CipherA cipherA): void+ encrypt(String plainText): String
LoginForm
- dao: UserDao
+ init(): void+ display(): void+ validate(): void
加法类
AbstractTransformer
运算类
+ NumbeA: double+ NumberB: double
...DatabaseSourceXMLTransformer...
Inheritance-继承
composition-复合
login
+ init(): void+ display(): void+ validate(): void+ findUser(String username): User+ getConnection(): Connection
Controller1
0 条评论
下一页