Archive

Posts Tagged ‘book’

The Decorator Pattern

March 15th, 2007 No comments

Decorator – Attach additional reponsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.

CName: Wrap

OO Principles:

  • Classes should be open for extension but close for modification.

Bullet Points:

  • Inheritance is one form of extension, but not necessarily the best way to achieve flexibility in our designs.
  • In our designs we should allow behavior to be extended without the need to modify existing code.
  • Compostion and delegation can often be used to add new behaviors at runtime. [阅读剩余部分…]
Categories: 读书学习 Tags: ,

The Observer Pattern

March 13th, 2007 No comments

Observer – defines a ont-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.

OO Principles

  • Strive for loosely coupled designs between objects that interact.

Bullet Points

  • The Observer Pattern defines a ont-to-many relationship between objects.
  • Subjects, or we also known them, Observables, update Observers using a common interface.
  • Observers are loosely coupled in that the observalbe knows nothing about them, other than that they implement the Observer interface.
  • You can push or pull the data of the Observalbe when using the pattern(pull is considered more “correct”).
  • Don’t depend on a specific order of notification for you Observers. [阅读剩余部分…]
Categories: 读书学习 Tags: ,

The Strategy Pattern

March 9th, 2007 No comments

The Strategy Pattern defines a family of algorithms, encapsulates each once, and makes them interchangebale. Strategy lets the algorithm vary independently from clients that use it.

OO Principles:

  • Encapsulate what varies.
  • Favor compostion ove inheritence.
  • Program to interface, not implementation.

Bullet Points:

  • Knowing the OO basics does not make you a great OO designer.
  • Good OO designs are reusable, extensible and maitainable.
  • Patterns are proven object-oriented experience.
  • Patterns don’t give you code, the give you general solution to design problems. You apply them to your specific application. [阅读剩余部分…]
Categories: 读书学习 Tags: ,

读了“与空姐同居的日子”

February 21st, 2007 No comments

这两天如同两年一样漫长,晚上无聊地玩着数独的游戏,累计都有360分钟了。

刚刚又一口气看完了一部小说,花三个小时。小说的名字叫“和空姐同居的日子“,或者是“和我同居的女人“,写非常好,也很美的故事。原先就看过一部分,但是担心会是悲剧性的结局,所以一直没有读下去。今天终于看完了,似乎美满的结局。他们的幸福是痛并快乐着。

Categories: 快乐每一天, 读书学习 Tags:

Road to Excellence

February 5th, 2007 No comments

看来语言还是很重要的,其实一直都明白这个道理,不过“行胜于言”这句话还是很有道理的。今天看了几篇别人的故事和一些相关的讨论,这种感觉就更加强烈。

多一门语言,路就宽很多。

Tag: Road to Excellence

Categories: 快乐每一天 Tags: ,