`
winzenghua
  • 浏览: 1370044 次
  • 性别: Icon_minigender_2
  • 来自: 广州
文章分类
社区版块
存档分类
最新评论

关于模型驱动开发的一个小争论(zt)

阅读更多

今天偶然撞见两个大师在讨论MDA的理念,收获颇多,特转帖于此。

source: http://sourceforge.net/forum/forum.php?thread_id=2014199&forum_id=544071

<!-- /forum/nested_messages.html - Copyright 1999-2006 (c) Open Source Technology Group @version $Id: nested_messages.html 14031 2007-01-10 14:24:43Z avoigt $ -->
Synergy with OpenXava<!-- google_ad_section_end -->
By: Javier Paniza (javierpaniza) - 2008-04-21 18:08
<!-- google_ad_section_start -->Hi all,

I'm Javier Paniza, project lead of OpenXava project,
http://www.openxava.org/
and I have a proposal for Naked Objects team and community.

OpenXava and Naked Objects are very alike products,
in fact, OpenXava compete against Naked Objects.
Even though, I think that Naked Objects and OpenXava
can cooperate in some way, and this can be profitable
for both, this can help us to gain ground against
MVC frameworks.

But, How ?

We can concentrate in portability. The idea is that a
develeper develops an applicaton for OpenXava, and in
any moment he could migrate it with a minimun effort
to NakedObjects. The same application, different engine
for running it. Even, if we will achieve a high level
of portability, the developer can have the application
on OpenXava (to use it inside a java Portal) or in NakedObject
to use it as a java Client Application.

How we can obtain this portability ?
We can start using standard java API as JPA for persistence,
and bean validation (JSR-303) for validation. Removing
from our frameworks all propietary annotation about these
issues.
Then, we can try to create a "common" specification for
layout, currently OX does it in this way:
http://openxava.wikispaces.com/view_en
and controller, OX does it in this way:
http://openxava.wikispaces.com/controllers_en


Maybe, this proposal is technically impossible,
or it's outside of the Naked Objects strategy.
But, maybe not.

This offer can include other model driven frameworks
as Trails, RomaFrameworks or JMatters.

What think about this the Naked Object team ?
What think about this the Naked Object community ?

Regards,
Javier Paniza





<!-- google_ad_section_end -->


    <!-- /forum/nested_messages.html - Copyright 1999-2006 (c) Open Source Technology Group @version $Id: nested_messages.html 14031 2007-01-10 14:24:43Z avoigt $ -->
    <!-- google_ad_section_start -->RE: Synergy with OpenXava<!-- google_ad_section_end -->
    By: Dan Haywood (dkhaywood) - 2008-04-22 00:08
    <!-- google_ad_section_start -->Hi Javier,
    Thanks for the post.

    What you'll be interested to hear is that we (and by 'we' I mean Robert Matthews, the chief architect of NOF, and myself as the only non-NOGL employee who is also a committer to the NOF) have been working to make the NOF more flexible in precisely this regard.

    We use the term "programming model" for the set of naming conventions and annotations that make up the meta-model. Unlike some of the frameworks you mentioned, the NOF builds its own meta-model independently of - say - Hibernate's HBM. This is done using a component called the "reflector", because it, erm, uses the java reflection APIs to build up said meta-model. I suspect that OpenXava works the same way.

    In Naked Objects 3.1 the reflector has been rewritten so that it is extensible. Basically each annotation or similar convention is represented as a facet. So, saying that a property "FirstName" has a @MaxLength(15) would be picked up by a MaxLengthFacetFactory which would attach a MaxLengthFacet onto this property in the metamodel. Similarly, if one writes a validateFirstName(String) supporting method then this is picked up as a ValidateFacet, again attached to the FirstName property. (You might recognize this as the extension object pattern, much used in the Eclipse API with its adapters).

    The extensibility comes in because new facet factories can be easily plugged in as required. If we wanted to support the Hibernate Validator @Length(max=...) annotation, we would just need to write a new implementation that would install its own MaxLengthFacet (assuming that the semantics are the same).

    You mentioned JSR-303. I've just had a quick look at the early access draft. For those reading this who aren't familiar (as I wasn't), the idea is to annotated one's own annotations (eg @NotNull) with a @javax.validation.ValidatorClass annotation that references an implementation of javax.annotation.ConstraintValidator. Thus, prior to saving/updating, all constraints are checked. To me, this looks exactly like the kind of thing that we would want to support, and facets should make this pretty easy to support.

    What I suggest you might want to do is go ahead and add support to OpenXava for JSR-303, and I will look at adding this as an (optional) component for Naked Objects. In fact, it'd make a good chapter in the book I'm currently labouring on covering Naked Objects.

    Regarding your broader idea of defining a standard programming model across all NO-like frameworks, that really is one for Richard and Rob (the founders of NOGL) to answer. However, I would doubt that it is that high up their agenda. What I can say is that in general we're really quite happy with the programming model that we have in NOF 3.0; it's taken a long time to evolve to where it is. Looking at the OpenXava programming conventions, I suspect for example that Richard wouldn't be that keen on having separate action classes (as opposed to simple public methods which is what the NOF itself uses). That said, there are a few ideas in OpenXava that I really quite like. One is your @View and @ReferencedView annotations - that's a nice approach (though repeating the names of properties in these annotations strikes me as fragile and violating the DRY principle). You also have support for suppressing properties in table views, which NOF doesn't yet have.

    Notwithstanding, there would be nothing to prevent you teaching the NOF about the OpenXava programming conventions by writing some facet factories yourself, once we release NOF 3.1.

    There is actually another deeper synergy which might exist, which would be to combine your meta-model builder with our reflector, perhaps by basing it on our reflector. In fact, I've been toying with the idea that the NOF reflector ought to be a mini-standalone project in its own right, so that one could write an Ant task to validate a collection of domain models as part of a build. For example, in OpenXava you would want to make sure that every @ReferencedView does indeed reference a @View that exists. HOWEVER, I'm getting somewhat above my station here; such a reworking really need agreement from Rob.

    I suspect that Richard and Rob will follow up with their own thoughts on your proposition. For myself I'm happy to continue the discussion either here on the forum or via email.

    Cheers
    Dan

    <!-- google_ad_section_end -->

      <!-- /forum/nested_messages.html - Copyright 1999-2006 (c) Open Source Technology Group @version $Id: nested_messages.html 14031 2007-01-10 14:24:43Z avoigt $ -->
      <!-- google_ad_section_start -->RE: Synergy with OpenXava<!-- google_ad_section_end -->
      By: Javier Paniza (javierpaniza) - 2008-04-24 10:33
      <!-- google_ad_section_start -->Hi Dan,

      > ... uses the java reflection APIs to build up said meta-model.
      > I suspect that OpenXava works the same way
      Yes. OpenXava works in that way.

      > The extensibility comes in because new facet factories can be easily plugged in as required
      OpenXava has not so great flexibility for the parsing of classes and annotations, it just parse a fixed meta-model. But, NO extensibility is an open door to take the first step of my proposal.
      Only if NakedObjects would implement JPA and Hibernate Annotation, we will have some degree of portability for applications between two frameworks.

      > What I suggest you might want to do is go ahead and add support to OpenXava for JSR-303,
      > and I will look at adding this as an (optional) component for Naked Objects.
      It's a very good start.

      > Regarding your broader idea of defining a standard programming model across all NO-like frameworks
      > I would doubt that it is that high up their agenda
      Yes. I know. But, We can work in order to grow the common part.
      That is, we can start with JPA and JSR-303 (or Hibernate Validator?),
      then try to use a common annotations for defining way,
      and left the controller part as not shared.

      > prevent you teaching the NOF about the OpenXava programming conventions
      Me, or someone from NakedObjects or OpenXava community.

      > to combine your meta-model builder with our reflector
      OpenXava parser read the OX meta-model from java + Annotations and
      from XML business components.
      Is the later supported by your "reflector"?

      Two question about NO 3.1,
      Will it support JPA ?
      Will it support Hibernate Validator annotations ?

      Thanks Dan for listen the proposal, and for your comments.

      Cheers
      Javier
      <!-- google_ad_section_end -->

    <!-- /forum/nested_messages.html - Copyright 1999-2006 (c) Open Source Technology Group @version $Id: nested_messages.html 14031 2007-01-10 14:24:43Z avoigt $ -->
    <!-- google_ad_section_start -->RE: Synergy with OpenXava<!-- google_ad_section_end -->
    By: Richard Pawson (rpawsonSourceForge.net Subscriber) - 2008-04-22 09:05
    <!-- google_ad_section_start -->Javier

    Thank you for your posting. I have been aware of OpenXava for some time, though I haven't used it.

    There is now a large, and growing, number of frameworks that claim some similarity to Naked Objects. Some of these have explicitly been inspired by Naked Objects, but aim to change or extend the idea in some way. (We have always encouraged this.) Others have been inspired independently.

    However, I am not always convinced of the similarity. A lot of these frameworks I would categorise as providing an 'Auto-generated CRUD UI'. That label isn't intended as a criticism: auto-generated CRUD UI is an idea whose time seems to have come. The basic idea is, of course, not new, but what is new is that most of these frameworks are now doing it by reflection rather than by code generation. More recently they have started to add the reflective recognition of validation/constraint logic, and, to a lesser extent, for adding functional behaviour. Because Naked Objects was one of the first frameworks to push these ideas this is where they see the similarity.

    However, Naked Objects did not arise from the question of how can we generate a UI automatically from either a database or an entity object model. It arose from two things:

    1. Trying to understand why people paid only lip-service to the idea of encapsulating all business behaviour as methods on those entity objects, which was the clear original intent of OO. This was the starting point for my PhD thesis (http://www.nakedobjects.org/downloads/Pawson%20thesis.pdf ).

    2. Trying to understand how to build more 'expressive' (problem-solving) styles of user interface. This research, which I conducted in the late 1990s, concluded that the key was true object-oriented user interfaces, of which the best work ever done, IMO, was IBM's ill-fated CUA.

    The Naked Objects pattern arose from the single insight that these two problems could actually be the solution to each other!

    Sorry for the mini history lesson but it is important that you understand that the idea of behaviourally-complete objects is absolutely definitional to Naked Objects. As Dan said in his posting, we have evolved the Naked Objects Progamming Model over the last eight years with this single goal in mind.

    Most of the frameworks that compare themselves to Naked Objects do not share this goal. That doesn't make them wrong (necessarily!) but it is important to bear in mind.

    Interestingly, the one framework that really did share this obsession was called Essential and was started by Dan himself, who was extremely familiar with Naked Objects having worked with us (and still does) at the Irish government. With Essential he wanted to take the ideas even further, but in the same direction.

    I was eventually able to persuade Dan not to pursue an independent framework but rather to contribute the best of his ideas into Naked Objects. Some of the key changes between Naked Objects 2.0 and 3.0 came from that joining of forces, as have many of the key ideas in the forthcoming 3.1, which I think we can safely say is far better than either Essential or Naked Objects would have been on their own. I am spelling this out because I don't want you to think that we are resistant to outside influence, even to substantial outside influence. That collaboration has ultimately worked because, though we often argue about particular ideas, we were convinced that Dan was in fact passionate about the same fundamental ideas.

    We are keen to open up Naked Objects further, indeed we recognise that we must. But all proposed changes in direction will be judged against that very clear vision. If you think that OpenXava really does share that clarity of vision, then I would strongly encourage you, as Dan did, to throw in your towel with Naked Objects and add to Naked Objects those unique capabilities that you have that could take it further. If you don't share that same vision, then I wish you all the very best for OpenXava.

    In the short run I predict that the auto-generated CRUD UI, extensible with functional behaviour, will prove to be a more popular than Naked Objects, which has been described as the most opinionated of all the 'opinionated frameworks'. But we have seen the promised land, and we ain't turning back from it now ;-)

    Kind regards

    Richard
    <!-- google_ad_section_end -->

      <!-- /forum/nested_messages.html - Copyright 1999-2006 (c) Open Source Technology Group @version $Id: nested_messages.html 14031 2007-01-10 14:24:43Z avoigt $ -->
      <!-- google_ad_section_start -->RE: Synergy with OpenXava<!-- google_ad_section_end -->
      By: Javier Paniza (javierpaniza) - 2008-04-24 11:25
      <!-- google_ad_section_start -->Hi Richard,

      > Others have been inspired independently.
      I think OX is in this group.
      OX started as an active code generator from XML definitions in 2001.

      > Most of the frameworks that compare themselves to Naked Objects do not share this goal.
      OpenXava does not share the Naked Objects 2 basic principles.

      About 1: All behaviour in model objects.
      Look at the comment in OX documentation:
      http://openxava.wikispaces.com/model_en#toc17
      Yes, I encourage OX developer to put all business logic in method of model classes.
      But, some logic is behaviour logic, NOT BUSINESS LOGIC, and it's more practical to put this behaviour logic in another place other than model classes; in the controller.
      For example, when you save an object to database, the way you use for saving is not business logic, you can saving using JPA or JDBC, or calling to a web service. Moreover, this logic can be reuse for all model classes. Therefore it's better separate this logic from model.
      Or, after save maybe you want to clear the view, or maybe not. Also, this is not business logic.
      It's useful separate business logic (in model classes) from behaviour logic (in actions).

      About 2: OO user interface.
      This is a good idea. I like it. But if you have a controller layer, you can choose to use an OO user interface, or whatever other, and you can change it.
      I want create from the same model an OO User Interface, a classic business applicationn style user interface, and a simple web wizard style user interface. That is, an OO user interface is only an option, but not the only one option.

      The OpenXava principles are:
      1. Business Component: All resources about a business concept in the same place. As opposite to the classic MVC approach.
      2. Declaring instead of programming: A way to obtain productivity.


      All above comments are my personal opinion, and I know that your opinion is different.
      Really, our frameworks have different histories and principles, but you have to admit that currently (at least in April 2008) the shape of the source code for producing a NO and an OX application is very alike, is it ?

      We can concentrate in this "common" part.

      > If you don't share that same vision, then I wish you all the very best for OpenXava.
      Yes. I don't share that same vision, although this is not impediment for synergy betweedn NO and OX.

      Keep these ideas in your mind. Who's know ?
      Maybe in the future you change your mind,
      or maybe I change my own mind.

      Cheers
      Javi<!-- google_ad_section_end -->
分享到:
评论

相关推荐

    Zebra ZT230 条码打印机驱动

    斑马(Zebra)ZT230条码打印机是一款广泛应用在工业环境中的高效设备,其驱动程序是确保打印机正常工作的重要组成部分。本驱动程序专为Zebra的ZT210、ZT220及ZT230系列打印机设计,提供了全面的功能支持,以实现高...

    斑马ZT510打印机驱动文件

    斑马ZT510打印机驱动文件

    斑马Zebra ZT510 驱动下载安装.exe

    斑马Zebra ZT510 驱动下载安装 使用中有任何问题可以关注并私信,如果资源对您有帮助记得关注收藏好评哟!

    证通ZT598金属键盘开发资料.rar

    总之,证通ZT598金属键盘的开发工作是一项技术性强、要求细致的任务。开发者需要具备一定的嵌入式系统开发经验,对SDK的深入理解和熟练应用是成功集成的关键。通过学习和实践,开发者将能充分利用这款设备的安全特性...

    ZT213/ZT213LEEA规格书V2.10-低功耗RS232多通道USB收发器/驱动器芯片手册

    ZT213/ZT213LEEA是一款专为低功耗应用设计的RS232多通道USB收发器和驱动器芯片,广泛应用于数据通信、工业控制、物联网设备等领域。本文将深入探讨其规格参数、功能特点、选型指南及应用实例,帮助读者全面了解这款...

    斑马zt210打印机驱动 v5.1.07.5146 官方版

    斑马zt210是一款专为中国市场设计的工业条码打印机,非常适合不需要频繁更换标签的条码标签应用。这里给大家提供斑马zt210驱动下载,推荐有需要的用户下载安装。斑马zt210打印机优势:◆ 节省空间* 小巧紧凑和流线型...

    斑马打印机(ZT210).docx

    斑马打印机ZT210是一款专业的工业级条形码和标签打印机,广泛应用于物流、零售、医疗等行业的标签制作。以下是对如何设置和使用斑马ZT210打印机的详细步骤: 首先,我们需要安装电脑驱动。双击下载好的驱动程序文件...

    斑马zt410打印机驱动 v5.1.7 官方最新版

    斑马zt410驱动是由斑马官方推出的打印机驱动程序,如果你的打印机与电脑的连接出现了异常而导致打印机无法正常的使用,下载此驱动能帮你很好的解决这个问题,欢迎购买了此型号打印机的朋友下载使用!斑马zt410打印机...

    ZT_中控 ID180身份证读卡器CS驱动!

    ”表明这是一个关于中控(Zkteco)ID180型号的身份证读卡器的计算机软件(CS驱动)。这种驱动程序是用于帮助计算机识别和通信与硬件设备,如身份证读卡器,进行数据交换的关键组件。 在描述中,同样提到了“ZT_中控...

    斑马ZT410驱动

    操作系统:Windows XP, Windows Vista, Windows 2008, Windows 2003, Windows 7, Windows 8, Windows 10, Windows Server 2012, Windows 8.1

    斑马Zebra打印机zt420驱动 v5.1.7 官方最新版

    斑马zt420驱动是专为该型号推出的打印机驱动程序,它可以有效地解决打印机不能正常的连接电脑和电脑不能识别打印机的问题,让打印机进行正常的工作和运转,欢迎有需要的朋友下载使用!斑马Zebra打印机zt420参数简介...

    ZT_中控 ID180身份证读卡器BS驱动!

    - `ZKIDROnline.exe`:这可能是一个在线版本的驱动安装程序,用户只需双击运行,按照提示完成安装步骤,就能使浏览器识别并支持ID180读卡器。 - `ZKIDCardReaderControl_Setup.exe`:这可能是读卡器的控制面板或...

    斑马zt410中文库

    斑马(Zebra)ZT410是一款先进的桌面级条码打印机,被广泛应用于物流、零售、医疗、制造业等多个行业。这款打印机以其高效、耐用和易于操作的特点深受用户喜爱。"斑马zt410中文库"指的是为ZT410打印机特别设计的中文...

    斑马ZT230驱动及网络打印机设置代码

    2. **解压文件**:下载的文件可能是一个压缩包,需要使用解压缩工具(如WinRAR或7-Zip)将其解压缩。在提供的压缩包子文件列表中,“斑马ZT230驱动及网络打印机设置代码”可能是解压后的文件夹名,包含驱动程序安装...

    zt411-zt421-ug-zhcn_ZT411/ZT421_斑马打印机手册_

    这份中文手册详细地介绍了ZT411和ZT421的操作、维护以及常见问题的解决方法,对于用户来说是一份非常重要的参考资料。 一、打印机概述 ZT411和ZT421是斑马技术公司推出的一系列高级热转印桌面打印机,具备高速打印...

    Zebra ZT610驱动,解决驱动异常

    Zebra ZT610驱动下载

    ZT短信平台接口开发文档

    ZT短信平台接口开发文档

    斑马ZebraZT210打印样例

    模板是一个预定义的布局,包含条形码、文本、图像等元素。用户可以根据业务需求创建和编辑这些模板,然后在打印时调用。`.prn`文件就是这种模板的格式,它是斑马打印机的专用文件,用于存储打印指令和布局信息。 在...

    沃视征途系列-ZT9404

    2. 驱动解压:将压缩包解压至一个方便查找的文件夹,确保所有驱动文件完整无损。 3. 关闭防火墙与杀毒软件:为了防止安全软件阻止驱动安装,暂时关闭防火墙和杀毒软件。 4. 运行安装程序:找到解压后的安装程序,...

Global site tag (gtag.js) - Google Analytics