《Head_First设计模式》.pdf
文章分类:Java编程1.策略模式部分*面向对象(00)的四个基本概念是:抽象、封装、继承、多态。
软件设计原则:封装变更——将软件中未来可能发生变更的部分分开,并与其他部分分开,以减少变更对它们的影响。这样的设计可以使系统具有弹性并更好地响应变化。
软件设计原则:程序为接口,不为实现。根据这个原则,在声明变量时,声明为超类型(接口或抽象类),而不是实现类。
* 继承的好处是实现代码复用。
*软件开发人员在“之后”花费更多的时间软件开发比“之前”既然已经完成了,那么就应该着眼于提高复用程度,以实现可维护性和可扩展性。
软件设计原则:多使用组合,少继承。使用组合方式可以实现代码的划分,使代码更加灵活,更好的提高可重用性。
策略模式:定义一组算法族,分别封装,使每个算法可以相互替换。此模式允许算法独立于使用算法的客户端进行更改。
(Article classification: Java programming 1 Policy mode section
*The four basic concepts of object-oriented (00) are: abstraction, encapsulation, inheritance and polymorphism.
Software design principle: encapsulate changes - separate the parts of the software that may change in the future and separate them from other parts to reduce the impact of changes on them. Such a design can make the system elastic and better respond to changes.
Software design principle: the program is an interface, not an implementation. According to this principle, variables are declared as supertypes (interfaces or abstract classes) rather than implementation classes.
*The benefit of inheritance is code reuse.
*Software developers spend more time "after" than "before". Now that software development has been completed, we should focus on improving the degree of reuse to achieve maintainability and scalability.
Software design principle: use more combinations and less inheritance. Using composition method can realize code division, make code more flexible and improve reusability better.
Policy pattern: define a group of algorithm families, which are encapsulated separately, so that each algorithm can be replaced with each other. This mode allows the algorithm to be changed independently of the client using the algorithm.)
页:
[1]