Design revisited

the goal of the design is to solve a problem in a general, reusable way.

several guiding principles of design help ensure that the patterns are flexible and applicable in many contexts.

Minimize Coupling

Coupling between classes should be minimized. Coupling refers to dependencies between objects. Whenever such dependencies exist, they reduce opportunities for reusing the objects independently.

to partition a complex system into sub-systems and minimize coupling between the subsystems.

 

Design for Change

It's important to use designs that accommodate changes through the lifecycle of a software system.

Designs that are too inflexible ultimately restrict opportunities for reuse.

It's possible to anticipate certain types of changes and accommodate them in a design.

Emphasize interfaces rather than implementations

Interfaces provide a kind of metaphorical contract between an object and the users of the object. An object's interface tells a programmer what the object is able to do but not how it will do it.

The goal of patterns is to enhance software reuse. The granularity of a pattern can have a huge impact on opportunities for reuse.

Ideally, neither the model nor the view have dependencies on the controller. For example, views oftern use the target action design pattern to avoid needing any information about the controller object that receive messages when user interacts with user interface objects. Model objects often use the notification pattern to broadcast notification of model changes to anonymous interested objects that may be in the controller subsystem.

 

 

 

posted on 2012-07-02 09:53  grep  阅读(135)  评论(0编辑  收藏  举报