《Head First Design Pattern》

[size=large][b]OO Basic[/b][/size]

Abstraction

Encapsulation

Polymorphism

Inheritance

面向对象的基础也就是抽象、封装、多态和继承。

==========================================================================

[size=large][b]OO Principles[/b][/size]

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.
单一职责,类有且只有一个变化的理由。

==========================================================================

[size=large][b]OO Patterns[/b][/size]

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.

==========================================================================

[size=large][b]Compound Patterns[/b][/size]

A Compound Pattern combines two or more patterns into a solution that solves a recurring or general problem.

==========================================================================

[size=large][b]Pattern Categories[/b][/size]

[b]Creational[/b]
Singleton
Builder
Prototype
Abstract Factory
Factory Method

[b]Structural[/b]
Decorator
Flyweight
Composite
Adapter
Proxy
Facade
Bridge

[b]Behavioral[/b]
Template Method
Interpreter
Chain of Responsibility
Visitor
Command
State
Strategy
Mediator
Iterator
Memento
Observer
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值