MDD:MDD 在运行时的动态程度如何?

发布于 2024-10-08 06:44:39 字数 176 浏览 7 评论 0原文

多年来,我研究了很多使用代码生成器和 MDD 的方法。我总觉得缺少一些东西:在运行时对模型进行修补和更改。

修补:如果您有代码生成器,则所有类应该看起来相同。现在你有一个例外。到目前为止,所有代码生成器都需要我修改模板或模板引擎才能使其工作。

如果我可以对代码生成步骤的结果应用补丁来修复异常,不是更好吗?

Over the years, I've investigated a lot of ways to use code generators and MDD. I've always felt that something is lacking: Patching and changes to the model at runtime.

Patching: If you have a code generator, all your classes should look the same. Now you have a single exception. All code generators so far would require that I modify the template or the template engine to make this work.

Wouldn't it be better if I could apply patches to the result of the code generation step to fix the exceptions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

倒带 2024-10-15 06:44:39

嗯,这取决于您如何构建模型。事实上,这取决于您使用的代码生成器、它的方法以及它可以让您做什么。

创建规则(模型)的例外或多或少违反 MDD 的本质,除非应用的建模方法允许您将例外添加为建模实体。

我认为 ABSE 是唯一接受“自定义代码”作为一流实体的建模方法,就像文本或整数一样。如果您创建包含“CustomCode”参数的模板,则稍后可以仅在必要时添加异常代码,而不会违反模型规则。这可用于添加或替换代码。您只需在模板中指定它即可。

AtomWeaver 是 ABSE 建模方法的免费实现。

Well, it depends on how you build your model. If fact, it depends on what code generator you are using, its approach, and what it lets you do.

Creating an exception to a rule (model) is more or less against the nature of MDD, unless the applied modeling approach allows you to add exceptions as modeling entities.

I think ABSE is the only modeling approach that accepts "custom code" as a first-class entity, just like a text or an integer. If you create a template that contains a "CustomCode" parameter, you can later add your exception code only when necessary, without breaking your model rules. This can be used to add or replace code. You just need to specify it in your template.

AtomWeaver is a free implementation of the ABSE modeling methodology.

〆一缕阳光ご 2024-10-15 06:44:39

MDD 不起作用,因为它基于域的视图而不是整个域。我的意思是,MDD 通常在来自 UML 图的条目中采用 XMI。问题是,该图只是域的视图,因此您有很多选择,而现实世界要复杂得多,特别是在部署阶段。

唯一为我的项目提供真正价值的公司是 Omondo 和 EclipseUML。 EclipseUML 并不尝试执行 MDD,而是在图表级别创建与代码实时同步的 UML。部署是使用代码中的 java 注释中添加的构造型进行的。因此,我可以建模,如果我添加部署构造型,那么我的应用程序可以立即部署/如果我手动更改我的代码,那么我的模型将被重构,并且我的所有视图都会更新。如果我想添加文档,那么我只需在元模型中添加注释即可。当我单击每个元素时,这些注释就会实时显示。不再需要打印文档,因为实时导航、动态视图创建等...

我的 EclipseUML 模型始终是最新的,并且我可以立即部署它,因为 Java 注释在模型、元模型、图表和代码之间实时同步。真的很酷:-) :-)

MDD doesn't work because it is based on a view of the domain and not the entire domain. I mean that usually MDD take an XMI in entry coming from an UML diagram. The problem is that this diagram is only a view of the domain and therefore you have many alternative and the real world is a mot more complex specially at deployment stage.

The only company which has provided me real value in my project was Omondo with EclipseUML. EclipseUML doesn't try to do MDD but create UML at diagram level live synchronized with code. Deployment is made using stereotypes which are added in the java annotation in the code. I can therefore model and if I add deployment stereotypes then my application can be deployed immediately/ If I manually change my code, then my model is refactored and all my views updated. If I want to add a documentation then I just add notes in the metamodel. These notes are live available when I click on each element. No more printed documentation needed because live navigation, dynamic views creations etc...

My EclipseUML model is always up to date, and I can deploy it immediately because Java annotations are lived synchronized between the model, the metamodel, the diagrams and the code. Really cool :-) :-)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文