开发者

Design patterns, how do they differ from other programming styles?

Design patterns aren't necessarily a programming style but rather a template for solving a problem开发者_如何学C in a number of different situations.

But how do they differ from other programming styles?

Thanks

Edit: "(a) What are design patterns? How do these differ from other programming styles? [7]"


A design pattern provides a known solution to a common design problem, and is given a name to allow programmers to communicate more efficiently.

However, I have no idea what you mean by "programming styles".

Edit: I think the question is simply very badly worded. While "design pattern" has a relatively clear definition, "programming style" is, in my experience, not a term with a generally agreed clear definition. The question seems to assume that design patterns are a kind of programming style, and I don't think that's true.


If we take "programming style" to mean this, then the primary difference between programming styles and design patterns boils down to form vs. function: programming styles merely suggest how code is supposed to look, but dont have anything to say about how the code works; while design patterns are all about how code is programmatically structured and executes, but say nothing about how the code looks.


Design patterns are common solutions to object-oriented programming problems, so they differ from other styles in exactly the same way that object-oriented programming does.


As I see it, programming styles refer to the "specifc" way in which you'd go about implementing something (Design patterns included). Although Design Patterns have traditionally been linked to OOP many design patterns still exist in other programming paradigms. The question, i think, is trying to prove whether or not you've got the difference between a "generic" and proven way of solving a problem, and an specific way of implementing a solution to "that" problem.

Regards,


I agree with other answers and in additional to that I think some program specific properties integrated some design pattern philosophy. Like the "delegate" keyword in C#, which implements the delegate pattern but it is absolutely supported by the language itself.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜