保持类图和code同步 [英] keep class diagram and code synchronized

查看:101
本文介绍了保持类图和code同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图写一些code之前,设计我的应用知识。我创建的所有类的类图我将使用并从中产生,然后code。使用 Astah

I am trying to design my applications know before writing some code. I've created class diagram of all classes am going to use and then generated code from them using Astah.

当我想改变某些类的方法,或添加一个新出现问题。在源$ C ​​$ C,一旦在类图和一次:我应该这样做两次。这样的变阵几个正在继续,我的类图变得容易过时。

The problem occurs when I want to change a method of some class or add a new one. I should do this twice: once in the class diagram and once in the source code. Several evolutions of this kind being proceeded, my class diagram becomes easily out of date.

有一些方法来避免这种情况?我可以更新已经从活动图现有code?

Is there some approach to avoid this? Can I update already existing code from activity diagram?

感谢您提前

推荐答案

有关回答你的问题,在我看来,有关考虑使用UML的方式。

For answering your question, it seems to me pertinent to consider the way UML is used.

UML精粹,Martin Fowler的考虑使用UML的方法有三种:

In UML distilled, Martin Fowler considers three ways of using UML:


  1. 草图

  2. 蓝图

  3. 可执行UML

1。素描

草图使用UML方便重构程序,这种做法是福勒认真感兴趣。一般来说,这是适当的有一个现有程序的综合感知。

The sketch use of UML is convenient for refactoring programs, a practice Fowler is seriously interested in. In general this is appropriate to have a synthetic perception of an existing program.

2。蓝图

蓝图是在某种程度上学术界使用的语言。主要的问题是在软件进化:型号必须与$ C $重新审视C不成为传统

Blueprint is in a way the academic use of the language. The main problem is in software evolution: the models have to be revisited with the code not to become legacy.

3。可执行的UML

可执行UML是一种在其成为前pression一节目的主要途径的语言的极端的实践。在这种情况下,通常是从其中包含的所有软件信息的初始UML模型生成的程序。该人士$ ​​C $ c是只有软件的过渡形式。该软件与模型,code再次生成演变。这是可能仅与软件的完整UML建模。在几句话,这是一个激进的使用UML。

Executable UML is a kind of extreme practice of the language in which it becomes the main way of expression for a program. In that context, the program is usually generated from the initial UML model which contains all the software informations. The source code is only a transition form of the software. The software evolves with the model, code generated again. This is possible only with a complete UML modeling of the software. In a few words, this is a radical use of UML.

我想使用UML这三种方式之间的区别是关于一般使用UML的相关考虑。

I think the distinction between these three ways of using UML is a pertinent consideration about the general use of UML.

UML作为源$ C ​​$ C修改接口

不过,我知道你在找什么:应该有使用UML,作为源$ C ​​$ C修改界面的另一个(第四)的方式。存在一些解决方案,但没有一个是真的很方便,这里有我所标识的举措:

However I understand what you are looking for: there should be another (fourth) way of using UML, as an interface for source code modification. A few solutions exist but none is really convenient, here are the initiatives I identified :


  • 绿色UML 是一个Eclipse插件通过水牛城使用它自己的类图编辑器,大学

  • code帆布是由一个研究项目微软,而不是UML但很有趣,一篇文章是的的ACM通信

  • BlueJ的是一个很轻的IDE,包括类图编辑器修改源$ C ​​$ C

  • 小粒的UML 是一个个人项目

  • Green UML is an Eclipse plug-in by the University of Buffalo which uses its own class diagram editor
  • Code Canvas was a research project by Microsoft, not UML but interesting, an article is available in the ACM communications
  • BlueJ is a very light IDE including a class diagram editor modifying the source code
  • Coffea UML is a personal project

在这里对几句话小粒。其目的是rel=\"nofollow\">的Eclipse JDT 的重构功能到的的Eclipse UML2Tools 图编辑器。它与类图编辑器工作正常。我的目标是把它扩大到活动图。不幸的是自那时以来,UML2Tools已经成为传统。的小粒的不是死了差不多。我从UML2Tools编辑分离的核心UML2功能。我的意图是在项目网站的详细。不过,我在它的工作在我的业余时间,我有其他职业。

A few words here about Coffea. Its purpose was to link the Eclipse JDT refactoring functions to the Eclipse UML2Tools diagram editors. It worked correctly with the class diagram editor. My ambition was to extend it to the activity diagram. Unfortunately the UML2Tools have become legacy since then. Coffea is not dead but almost. I have separated the core UML2 functions from the UML2Tools editors. My intentions are detailed in the project site. However I work on it on my spare time and I have other occupations.

UML可以用作为源$ C ​​$ C修改的接口,当且仅当修改仅在一个方面(例如行为或结构)。这将是非常不可能有该软件的玉米prehensive版可执行的UML的范围之外。对于这样的目的,所谓的编辑将多个图表,这将是非常复杂的组合。这样的编辑应靠近福勒描述的草图模式。

UML can be used as an interface for source code modification if and only if the modification is only on one aspect (e.g. behavioral or structural). It would be quite impossible to have a comprehensive edition of the software outside of the scope of Executable UML. The supposed editor for such a purpose would be a combination of multiple diagrams, what would be very complicated. Such an editor should be close to the sketch mode described by Fowler.

结论

不幸的是,我认为,UML作为源$ C ​​$ C修改一个接口是目前一些理论。一个主要挑战是修改与最初的UML模型(你的情况)集成。鉴于各种UML工具,我认为UML的福勒的用途是唯一的解决方案严重。看来你只能使用 Astah 可执行UML。我甚至不知道该工具提供的所有功能这样做。

Unfortunately, I think that UML as an interface for source code modification is currently something theoretic. A main challenge would be to integrate the modification with an initial UML model (your case). Given the variety of UML tools, I think Fowler's uses of UML are the only serious solutions. It seems you can only use Astah for Executable UML. I am not even sure the tool provides all the features to do so.

这篇关于保持类图和code同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆