裸体物体.是好是坏

Mid*_*hat 15 java frameworks naked-objects

我最近接触过裸体物体.它看起来像一个相当不错的框架.但是我并没有像Spring那样广泛使用它.那么为什么这个框架没有获得任何主流应用程序的功劳 你看到它的缺点是什么?

小智 10

根据我使用NOF 3.0.3的经验......

好处:

  • 自动为您的域对象生成DnD UI,就像db4o为持久性所做的那样.
  • 根据MVC模式创建者的说法,这就是MVC一直以来的意义.
  • 该框架仅要求您的域对象(PO​​JO)从AbstractDomainObject进行子类化,这是所有最小的布线.
  • 该框架支持常规OVER配置:许多注释没有怪异的XML配置.
  • 适用于原型设计以及db4o的持久性.
  • 开箱即用的Hibernate功能.
  • 就我而言,我需要从下载到Hello world应用程序的30分钟.(IntelliJ IDEA IDE)
  • 部署为JNLP,独立,Web(NOX​​嵌入式Jetty或Scimpi风格)和Eclipse RCP.
  • 当您在论坛中寻求帮助时,NOF团队随时为您服务.
  • 裸体对象模式是一个很棒的主意,帮自己一个忙,花点时间去讨好它.
  • 拖放GUI周围有很多可用性火炬,但如果您的潜在最终用户根本无法 使用DnD UI,那么无论如何您都会陷入深深的麻烦.

坏事:

  • 没有我能想到的.

有点难看:

  • 不允许Swing组件,所以告别JGoodies和所有你最喜欢的Swing组件集.UI组件是定制的; 让你明白他们看起来像90年代早期的VB控件.但是有一个SWT端口在工作中.
  • 长字符串的多行字段存在一些问题.(NOF 3.0.3)
  • 用于图像的DnD UI有点儿.
  • 如果从UI修改域对象,则仅触发getter n setter的验证代码.(由于我的n00bness,这可能是错误的,希望NOF提交者纠正我)
  • 如果从非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.


Gar*_*our 7

它已在爱尔兰成功使用.

我认为它之所以不受欢迎的原因是:

  • 您需要对所使用的工具包充满信心
  • 它使GUI成为一个风险因素,而不是简单的(在技术和可用性测试中)
  • 它不适用于网络(据我所知),这是目前大多数焦点所在......

  • Midhat - 不确定你的意思是什么'只是政治'.我对爱尔兰政府项目有第一手的了解.社会保障部使用Naked Objects框架交付了大约35个主要项目,每天全天使用2000+用户(很快将扩展到6000).该系统支持管理和支付各种州的福利,包括所有州的养老金. (3认同)

Ric*_*son 5

我刚看到这个.一些小的修改,否则大多数评论是非常公平的.

1)'框架只要求你的域对象(PO​​JO)从AbstractDomainObject子类化,这是所有最小的布线.

Naked Objects不要求将域对象从AbstractDomainObject子类化,尽管这通常是最方便的事情.

如果您不想继承,那么您需要做的就是提供IDomainObjectContainer类型的属性,然后框架将在创建或检索对象时将容器注入其中.容器具有Resolve(),ObjectChanged()和NewTransientInstance()的方法,它们是您必须使用的框架的三个极简主义接触点,以便框架与您的域对象保持同步.

2)'与db4o一起用于原型设计非常适合持久性'.我们非常热衷于使用db4o的想法,但我不知道有谁让Naked Objects和db4o一起玩.如果有人这样做了,我想更多地了解它.

3)'在小谈话和裸体对象社区中支持的citzen程序员的一般模型......'.我们从未支持过这个想法,我不同意.裸体对象不是鼓励用户编程.我坚信专业开发人员的作用 - Naked Objects只是帮助他们更好地编写更好的软件.

理查德