当要使用的设计模式? [英] When to use which design pattern?

查看:153
本文介绍了当要使用的设计模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢设计模式非常多,但我觉得很难看的时候我可以申请之一。我看过很多网站,其中设计模式进行了说明。我明白了其中大部分,但我觉得很难承认我自己的情况的模式。

I like design patterns very much, but I find it difficult to see when I can apply one. I have read a lot of websites where design patterns are explained. I do understand the most of them, but I find it difficult to recognize a pattern in my own situations.

所以,这就是为什么我问这个问题。是否有任何指引/警钟时使用的设计模式。

So, that is why I ask this question. Are there any guidelines / alarm bells when to use which design pattern.

例如,如果你正在做一个switch语句来确定哪些对象需要创建,你可能要使用的工厂设计模式。因此,在这种情况下,switch语句是一个警钟使用工厂模式。

For example, if you are doing a switch statement to determine which object you need to create, you probably want to use the factory design pattern. So the switch statement in this case is a 'alarm bell' to use the Factory pattern.

那么,你知道更多'警钟',以确定一个设计模式?

So, do you know more 'alarm bells' to determine a design pattern?

推荐答案

对于初学者只是采取偷看在这个页面:
http://codebetter.com/jeremymiller/2006/04/11/six-design-patterns-to-start-与/

For starters just take a peek at this page: http://codebetter.com/jeremymiller/2006/04/11/six-design-patterns-to-start-with/

虽然杰里米这里有几组模式交易,你必须阅读这些文章,然后用这个跟进:
< A HREF =htt​​p://codebetter.com/jeremymiller/2005/09/01/learning-about-design-patterns/> http://codebetter.com/jeremymiller/2005/09/01/learning-about-设计模式/

While Jeremy here deals with a few set of patterns, you must read these articles and then follow it up with this: http://codebetter.com/jeremymiller/2005/09/01/learning-about-design-patterns/

此外,使用此文章(尤其是埃里克·伽马的采访)的引用,你应该设置。

Also use the references on this article(especially Eric Gamma's interview) and you should be set.

这篇关于当要使用的设计模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆