Use Design Pattern Directly Or Not?

来源:互联网 发布:网络聊天的危害 编辑:程序博客网 时间:2024/05/09 20:07

<<Agile Software Development>>里面提到这么个问题
“If you are familiar with design patterns ,then when faced with a design problem,a pattern will very likely pop into your mind .The question then is whether or not to implement that pattern directly,or to continue to evolve the code through a series of small steps.”

呵呵,自己也困惑过,而且在做项目的时候还和同事争论过这个问题。
对我来说,决定的主要因素是时间,如果项目时间稍微宽裕点,那么我会从设计的一开始就花多点时间考虑使用模式,否则----当然是想用也没时间的。

书里面的建议是Step by step. 另外还提到,设计的开始阶段选用的设计模式不一定是合适的;从xp的观点来说,一开始就用设计模式容易陷入过度设计。

原创粉丝点击