`

One note of Head first design pattern(Command pattern)

阅读更多
I read the sixth chapter of Head first design pattern a few days ago.I want to review it at the present.

    First,here is the official definition.The commond pattern enscuplates a request as a object ,thereby letting you parameterized other objects with the different requests,and support the undo operation.

    This pattern decouple the invoker of a request and a receiver of a request.it encuplates the receiver of the request into the concretecommand object,what'more ,the concrete command class implements the command interface.as this,the invoker only corresponds with the command interface,and doesn't make attention to the receiver,in addition,the invoker also doesn't need to konw how the recevier carry out the request.
   
   The command pattern encuplates the method invocation,that is ,the exceute() method of command interface.and it also show us some oo design principle.such as favor composition than inhertiance,encuplate what varys,strive for the lossly coupling between objects.
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics