存储库模式属于哪种类型? [英] What type is repository pattern in?
问题描述
一般来说,我知道设计模式有3种
In general, I know that there are 3 big types of design pattern
- 创意模式(工厂,单例等)
- 结构模式(复合,适配器,代理等)
- 行为模式(规范,命令等)
但是我不知道可以将哪种存储库模式放入其中.
But I dont know which type I can put the Repository pattern in.
存储库模式是否为上述三种类型之一?还是在(2)和(3)模式的中间?
推荐答案
存储库可以被视为一种特殊的外观(结构),也可以被视为一种特殊的工厂(创意).另外,由于存储库经常公开类似集合的接口,因此它可能是Iterator(行为)的特殊应用.
Repository can be viewed as a special kind of Façade (structural) but also as a special kind of Factory (creational). Also, as the Repository often expose collection-like interface, then it might be a special application of Iterator (behavioral).
我要说的是,这些类别和模式本身都不是任何确定的学说.只有一些想法和一种语言试图使它们更清晰可见.这些类别只是试图以某种方式表达某些模式的功能的助手.模式也只是通用松耦合原理的各种表达.他们的边界很模糊.
What I am trying to say is that neither those categories nor patterns themselves are any sort of definite doctrine. There are just some ideas and a language that tries to make them more explicitly visible. These categories are just helpers trying to express somehow what some patterns do. Also patterns are just various expressions of a generic loose coupling principles. Their borders are blurry.
这篇关于存储库模式属于哪种类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!