需要框架设计指导
我已经进入设计模式相当一段时间了(比如 4 个月),并且在我们的项目中实现了许多设计模式。我已经获得了知识(虽然目前不会说自己是大师)并且我相信我对它们有很好的控制力。
我正在考虑逐步将这些知识转移到框架设计中。但我对此没有任何经验。
你们能指导我至少完成最初的步骤吗?
谢谢
I have been into the design pattern for quite sometime (say 4 months) and has implemented many in our project. I have gained knowledge(though won't say myself as a master at present) and I believe that I have good control over them.
I am thinking to gradually move this knowledge into framework design. But I donot have any experience on that.
Could you people please giude my in making atleast the initial steps.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好的框架需要使用一些设计模式,这可能是必不可少的。
比方说 - Spring MVC。很明显,您将使用 MVC。
就说 GWT 吧。 GWT 最好与 MVP 一起使用。
就说休眠吧。您将使用 DAO。 (有人说根据核心定义它不是真正的设计模式,但现在全球都将其视为设计模式)
等等。没有真正的食谱。我会给你一些我的想法,你可能会将它们视为使用设计模式的一些“步骤”:
The good framework will require using some design pattern, it might be essential for it.
Let's say - Spring MVC. It's quite obvious, you'll be using MVC.
Let's say GWT. GWT is best used with MVP.
Let's say Hibernate. You'll be using DAO. (Some say it's not real design pattern by core definition, but it's globaly considered as design pattern nowadays)
And so on. There is no real reciepe. I'll give you some of my thoughts, you might consider them as some 'steps' in using design patterns:
框架设计比应用程序设计困难得多。我刚刚在我的博客上写了一篇关于它的文章,并提出了我遵循的框架设计的三个理想。
第 1 点和第 2 点很重要,因为一旦发布版本,重构可见的 sdk 会导致重大更改。如果您希望开发人员使用您的 sdk,第 3 点很重要。
对我来说,这些理想支配着我在框架设计中做出的每一个决定。在整个过程中我必须一遍又一遍地考虑它们。我在文章中提出了一些实现这些目标的技巧。
框架/SDK/API 设计技巧
在设计模式方面,我想我遵循了与你类似的道路。几年前,我了解了设计模式,并意识到它们有多么强大(和破坏性)。我在一些程序中使用了一些,并最终在框架上使用了一些。我发现在我的框架中,我有机会应用我没有在应用程序中使用的新模式(我突然想到,我只能想到模板方法,并且我相信我在框架中使用工厂的次数比但我不记得所有的细节)。
祝你好运。我认为框架设计是困难的,但也是有回报的。
免责声明:我不是框架设计方面的专家……只是我涉足过的一些东西。
Framework design is much more difficult than application design. I just wrote an article on my blog about it and came up with three ideals that I follow for framework design.
Points 1 and 2 are important because once a release is made, refactoring the visible sdk results in breaking changes. Point 3 is important if you want developers to use your sdk.
For me, these ideals govern every decision I make in my framework design. I had to consider them over and over throughout the whole process. I put a bunch of tips in my article to achieve these goals.
Framework/SDK/API Design Tips
In terms of design patterns, I think I followed a similar path to you. I learned about design patterns a few years ago and realized how powerful (and destructive) they can be. I used some in some programs, and eventually got to use some on a framework. I found that in my framework, I got a chance to apply new patterns that I did not get to use for applications (off the top of my head, I can only think of template method and I believe I used factories more in my framework than in an application. I can't remember all the details though).
Good luck. I think framework design is difficult but also rewarding.
Disclaimer: I am not an expert in framework design...just something I've dabbled in.