One onte of Head first design patterns(Observer pattern)

I read the chapter two of  Head first design pattern just now,next ,i will just make a record.

        This chapter tells us how to use the observer pattern.after read it ,i realized that   the

observer pattern is very important and usefull to us .now i will sum it up .

        The observer pattern is used in the following condition.when our system contains a

one -to- many  dependency between objects,what'more,it is necessary that the change of

one object 'state  will make all of the dependents notified and updataed.here is the formal

definition of the observer pattern:The observer pattern defines a one-to-may dependency

among objects so that when one object changes state,all of its dependents are    notified

and updataed automatically.

       Next,i will sum up the characters of the observer pattern.the subject part,the abstract

observer,the concrete subject and the concrete observer.

      This pattern shows up server oo design principles.here are they .

      1 indentify the aspects of your app that vary and separate them from what stays    the 

 same . in the pattern,what vary are the state of the subject and the number of the observer.

 with this pattern,the things vary are well  encapsulated.

     2 programe to interface ,not to implementation.

     3 favor composition than inheritance.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值