Mid*_*hat 15 java frameworks naked-objects
我最近接触过裸体物体.它看起来像一个相当不错的框架.但是我并没有像Spring那样广泛使用它.那么为什么这个框架没有获得任何主流应用程序的功劳 你看到它的缺点是什么?
小智 10
根据我使用NOF 3.0.3的经验......
好处:
坏事:
有点难看:
如果从非ui线程修改了一个对象,那么就说一个bg worker,这样的对象
不会在屏幕上更新它的视图.这使用例无效,例如在DnD自动生成的UI上实时表示邮件队列.(再次)
韦科
Fil*_*vić 10
I've been working on the naked objects approach for over a year now and I haven't even begun to scratch the surface of the possibilities it provides for your system's architecture. To properly utilize it though, it requires that you create a paradigm shift and seek out full OO solutions and revert from resorting to functional duck tapes, because the paradigm seems to work only when you create a design that would allow for high-level development.
Having said that, I absolutely love how Django has implemented naked objects within it's Django Models. Most of the things I love about the framework have been, what I come to believe, a direct result of it's models and there are some wows off the top I'd like to share about the architecture:
Model fields, that map to table columns, are behaviorally complete objects--they know how they're represented in both the application and database domain, how they're converted between the two and how the information they hold is validated and displayed to the user visually for inputs. All of this utilized with a single line of code in your model. Wow!
Managers are attached to models and provide CRUD and any generic operations on collections, such as reusable queries (give me the last five blog posts, most occuring tags, etc.), mass delete\update operations, and business logic performed on instances. Wow!
Now consider you have a model that represents a user. Sometimes, you'd only like to have a partial view of all the information a user model holds (when resetting a user's password you may only need need the user's email and his secret question). They've provided a Forms API that exactly displays and manages inputs for only parts of the model data. Allows for any customization of the what/how in handling user input. Wow!
The end result is that your models are only used to describe what information you use to describe a particular domain; managers perform all the operations on models; forms are used for creating views and for handling user inputs; controllers (views) are only there for handling HTTP verbs and if they work with models it's solely through managers and forms; views (templates) are there for the presentation (the part that can't be automatically generated). This, imho, is a very clean architecture. Different managers can be used and reused across different models, different forms can be created for models, different views can use different managers. These degrees of separation allow you to quickly design your application.
You create a ecosystem of intelligent objects and get a whole application from the way they're interconnected. With the premise that they're loosely coupled (lot's of possibilities for letting them communicate in different ways) and can be easily modified and extended (a few lines for that particular requirement), following the paradigm you really do get an architecture where you a component write once and then reuse it throughout your other projects. It's what MVC should have always been, yet I've often had to write something from scratch even though I did the same thing a few projects ago.
我刚看到这个.一些小的修改,否则大多数评论是非常公平的.
1)'框架只要求你的域对象(POJO)从AbstractDomainObject子类化,这是所有最小的布线.
Naked Objects不要求将域对象从AbstractDomainObject子类化,尽管这通常是最方便的事情.
如果您不想继承,那么您需要做的就是提供IDomainObjectContainer类型的属性,然后框架将在创建或检索对象时将容器注入其中.容器具有Resolve(),ObjectChanged()和NewTransientInstance()的方法,它们是您必须使用的框架的三个极简主义接触点,以便框架与您的域对象保持同步.
2)'与db4o一起用于原型设计非常适合持久性'.我们非常热衷于使用db4o的想法,但我不知道有谁让Naked Objects和db4o一起玩.如果有人这样做了,我想更多地了解它.
3)'在小谈话和裸体对象社区中支持的citzen程序员的一般模型......'.我们从未支持过这个想法,我不同意.裸体对象不是鼓励用户编程.我坚信专业开发人员的作用 - Naked Objects只是帮助他们更好地编写更好的软件.
理查德
归档时间: |
|
查看次数: |
7719 次 |
最近记录: |