UML类图:如何建模有关调用一个方法或启动一个活动或服务的关系 [英] UML class diagram: how to model relations about calling a method or starting an activity or service

查看:1980
本文介绍了UML类图:如何建模有关调用一个方法或启动一个活动或服务的关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要创建我的第一个Android应用程序。我已经避免了标签协会与用户和系统的交互(例如我已经标记的启动的而不是 startsWhenClick 的,我已经标记的启动的而不是 startsWhenDetection 的)。不过,看完后<一href="http://programmers.stackexchange.com/questions/211886/how-can-i-indicate-if-an-object-operates-with-another-one-in-an-uml-class-diagra">this,我正在考虑改变的启动的通过的&LT协会;&LT;创建>> 的相关性。我很困惑!

I'm creating my first Android app. I have avoided to label associations with user or system interactions (e.g. I have labeled starts instead startsWhenClick; I have labeled starts instead startsWhenDetection). However, after reading this, I'm considering to change the starts associations by << create >> dependencies. I'm confused!

该应用程序的工作原理如下。当应用程序启动时,LauncherActivity将调用BaseActivity的方法来启动标识SettingsActivity活性(可以是SettingsActivity太)。 LauncherActivity将推出这两项服务了。这是图:

The app works as follow. When the app starts, LauncherActivity will call the methods of BaseActivity to start the activity marked in SettingsActivity (it could be SettingsActivity too). LauncherActivity will launch both services too. This is the diagram:

注:这个问题是<一个延续href="http://stackoverflow.com/questions/21592481/how-to-re$p$psent-the-call-to-a-class-through-another-class-using-an-uml-class-di">this的问题。

Note: this question is the continuation of this question.

推荐答案

这是不是一个真正的类图。

It is not a real class diagram.

  • Starts and calls belong to notes, or if you are sure you want to see them on connections, do stereotypes on DEPENDENCIES, not associations.
  • You still have no associations, and they are the main part of the class diagram. Look here about how to work with them. You should create associations first. Only after that show the dependencies. (It is not a common rule, but you should do so for better understanding)
  • As for the actions you are trying to show here, do State Machine diagram for them, then probably Sequence or Activity diagram. Don't use Interaction overview diagram, you'll get lost in it.

但是,停止把这么多行动,类图

恕我直言,因为活动有没有或几乎没有结构的依赖性,适当的类图会非常差 - 不关联的简单块。及属地遍布场......那么,类图是不是在这个层面上是有用的。看来,我已经告诉你们,类图是类是在一个同样采用Android的意图 - 一个或多个的意图

IMHO, because Activities have no or almost no structure dependencies, the appropriate class diagram will be very poor - simple blocks without associations. And dependencies all over the field... So, the class diagram is not useful on this level. It seems, I have told you already, that class diagrams are for classes that are in one same Android intent - one or more for an intent.

至于通信图,我想这是不是你的情况。这是比较常见的,贴近用户,比序列或活动图。它是这样,当你有很多种类的消息,你正在计划他们的路线。对于骆驼的规划,例如。但很可惜 - 这还没有实现信息的模式。因此,它仍然只为与短信群发系统中非常常见的规划。您的消息开始,启动元件等。你不能与图表表现出来。

As for communication diagram, I think it is not your case. It is more common, close to user, than sequence or activity diagrams. It is for the case when you have very many sorts of messages and you are planning their routes. For Camel planning, for example. But alas - it has not implemented message patterns. So, it remains only for very common planning of systems with mass messaging. Your "messages" are starting, initiating components and so on. You can't show it with that diagram.

您可以尝试对象图组合结构图。如果你想显示的类图上的功能,你不能这样做,但你可以移动到这些的。

You can try Object Diagram, or Composite Structure diagram. If you want to show functionality on the class diagram, you can't do it, but you can move to these ones.

这篇关于UML类图:如何建模有关调用一个方法或启动一个活动或服务的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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