Categories of design patterns [closed]

五迷三道 提交于 2019-12-06 07:19:58

问题


The classic "Design Patterns: Elements of Reusable Object-Oriented Software" actually introduced most of us to the idea of design patterns.

However these days I find a book such as "Patterns of Enterprise Application Architecture" (POEA) by Martin Fowler, much more useful in my day to day work.

In discussions with fellow developers, many make the (fair) point that frameworks like .NET are slowly starting to provide many of the patterns in the GOF book, and so why re-invent the wheel?

It seems many developers think that the GOF book is the only reference worth having on design patterns. So their logic goes that because frameworks (.NET etc) are providing many GOF patterns for us, patterns have seen their day and are no longer as important.

Surprisingly (to me at least) when I mention the patterns descibed in POEA, I am often met with blank stares.

POEA proves that patterns are more than just Interators, Singletons, Commands etc. I would also say that the patterns in GOF are really just a distinct "category" of patterns, applicable to a different (non-overlapping) level of design, than those in POEA.

So, what other "categories" of patterns have applied in your development? What level of design do these patterns apply to? At what point in the development process are they normally used? Is there a book or reference for these patterns?


回答1:


CategoryPatterns on Ward's wiki contains a categorized list of patterns.

The first three are the GoF patterns

  • Creational
  • Structural
  • Behavioural

Then there are problem specific problems

  • Security
  • Concurrency
  • RealTime

Fowler's pattern are Enterprise Application Patterns. There are also Enterprise Integration Patterns. UI patterns also exist.. and so on...




回答2:


I'm just adding an answer since I had this question answered somewhat differently. According to POSA (the Pattern Oriented Software Architecture series of books), there are three levels of patterns :

  • Architectural Patterns (e.g. Layers, MVC, P2P )
  • Design Patterns (e.g. GoF patterns)
  • Idioms (e.g. language specific patterns like Pimpl, RAII in C++)



回答3:


The GoF patterns are also strictly applicable to code only. Fowler's patterns are not just for code but also for how data and system components are arranged and interconnected.

Also, some patterns are not necessary if they're already baked in the programming language. In some languages they are simply idioms. One has actually made the argument that design patterns are signs of programming language deficiency.



来源:https://stackoverflow.com/questions/125656/categories-of-design-patterns

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!