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.

 

 

 

转载于:https://www.cnblogs.com/grep/archive/2012/07/02/2572738.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值