OO Basic
Abstraction
Encapsulation
Polymorphism
Inheritance
面向对象的基础也就是抽象、封装、多态和继承。
==========================================================================
OO Principles
Encapsulate what varies.
封装变化。
Favor composition over inheritance.
优先使用组合,而不是继承。
Program to interface, not implementation.
面向接口编程,不要面向实现编程。
Strive for loosely coupled designs between objects that interact.
在设计交互对象时应力求解耦。
Classes should open for extension but closed for modification.
类应该要做到对扩展开放,对修改关闭。也就是不修改一个类,也能对其进行扩展。
Depend on abstractions.Do not depend on concrete classes.
依赖于抽象,而不是具体的实现类。
Only talk to your friends.
不要和陌生人说话。
Don't call us, we will call you.
好莱坞法则。
A class should have only one reason to change.
单一职责,类有且只有一个变化的理由。
==========================================================================
OO Patterns
Strategy - defines a family of algorithm, encapsulates each one, and makes them interchangeable.Strategy lets the algorithm vary independent form client that use it.
Observer - defines a one-to-many dependency between objects so that when one objects changes state, all its dependents are notified and updated automatically.
Decorator - Attach additional responsibilities to an object dynamically.Decorators provide a flexible alternative to subclassing for extending functionality.
Abstract Factory - Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
Factory Method - Define an interface for creating an object, but let subclasses decide which class to instantiate.Factory Method lets a class defer instantiation to the subclasses.
Singleton - Ensure a class only has one instance and provide a global point of access to it.
Command - Encapsulates a request as an objects, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations.
Adapter - Converts the interface of a class to another interface clients expects.Let classes work together that couldn't otherwise because of incompatible interface.
Facade - Provides a unified interface to a set of interface in a subsystem.Facade defines a higher-level interface that makes the subsystem easier to use.
Template Method - Define the skeleton of an algorithm in an operation, deferring some steps to subclasses.Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm's structure.
Iterator - Provide a way to access the elements of an aggregate objects sequentially without exposing its underlying representation.
Composite - Compose objects into tree structure to represent part-whole hierarchies.Composite let clients treat individual objects and compositions of objects uniformly.
State - Allow an object to alter its behavior when its internal state changes.The object will appear to change its class.
Proxy - Provide a surrogate or placeholder for another object to control access to it.
==========================================================================
Compound Patterns
A Compound Pattern combines two or more patterns into a solution that solves a recurring or general problem.
==========================================================================
Pattern Categories
Creational
Singleton
Builder
Prototype
Abstract Factory
Factory Method
Structural
Decorator
Flyweight
Composite
Adapter
Proxy
Facade
Bridge
Behavioral
Template Method
Interpreter
Chain of Responsibility
Visitor
Command
State
Strategy
Mediator
Iterator
Memento
Observer
分享到:
相关推荐
深入浅出设计模式 (Head First Design Pattern)_带书签 深入浅出设计模式 (Head First Design Pattern)_带书签
headfirst design pattern C++ code
### Head First设计模式知识点概述 #### 一、章节概览:欢迎来到设计模式的世界 《Head First设计模式》是一本由Eric Freeman、Elisabeth Freeman、Bert Bates和Kathy Sierra共同编写的书籍,该书由O'Reilly出版社...
Head First design pattern(中文版).part4.rar
比现在csdn上的headfirst design pattern要清晰得多
Head First design pattern(中文版).part7.rar
Head First design pattern(中文版).part6.rar
著名的《Head First Design Pattern》学习笔记,摘要这本书中的设计思路。由于书本过长,整理出笔记帮助回想起设计模式。文件是docx格式,只能由OFFICE Word 2007之后的版本打开,内附Visio类图文件。本文由个人整理...
如果你曾经读过任何一本深入浅出(Head First)系列书籍, 你就会知道能够从本书中得到的是:透过丰富的视觉效果让你的大脑充分地运作。本书的编写运用许多最新的研究,包括神经生物学、认知科学以及学习理论, 这...
head first design pattern(chinese version) 1 what is the design pattern 2 why to use 3 how to use 4 questions when use,and how to resolve 5 funny when reading
Head First design pattern(中文版).part5.rar
Head First design pattern(中文版).part1.rar
很好的一本设计模式教程,形象易懂。很多抽象的设计模式概念在书中只用一个生动的例子就讲清楚了。不可多得,不可错过。
中文目录(书为英文): 1 欢迎来到设计模式世界:设计模式入门 模拟鸭子应用 Joe想到继承 利用接口如何? 软件开发的不变真理 分开变化和不变部分 设计鸭子的行为 测试鸭子的代码 ...
Head First Design Patterns 中文版 带目录 设计模式经典书籍
首先,从标题“Head First design pattern非扫描版 原生版”和描述中,我们可以得知这本书是关于“设计模式”的,使用Java语言编写。它被称为非扫描版,这可能意味着书籍内容是扫描后人工校对过,尽量保证没有错误,...
《Head First设计模式》是一本深受程序员喜爱的经典书籍,它以非扫描的原生版形式呈现,确保了阅读的清晰度和舒适性。这本书主要针对Java编程语言,深入浅出地讲解了设计模式这一核心软件工程概念。设计模式是经验...