当前位置 : 主页 > 手机开发 > 无线 >

UML:如何为移动应用程序建模UI和后台线程(iPhone / iOS,Android)

来源:互联网 收集:自由互联 发布时间:2021-06-10
Stackoverflow上有一些关于如何在UML中建模不同线程的相关主题,例如: Is there an inituitive UML approach to depict threads. 但我还是觉得,我的情况还没有讨论过,尽管它应该很常见: 我正在创建一个
Stackoverflow上有一些关于如何在UML中建模不同线程的相关主题,例如: Is there an inituitive UML approach to depict threads.

但我还是觉得,我的情况还没有讨论过,尽管它应该很常见:

我正在创建一个iPhone应用程序,我显然有一个主UI线程,我也使用Background-Threads来执行远程调用等.我基本上有4个不同的方面,我喜欢在我的diagramm中显示:

>向用户显示的UI.
> Main-UI-Thread正在执行的任务(因此阻止了UI)
> Background-Threads执行的任务
> UI的更新,由UI-Thread执行,但可以由Background-Threads触发.例如:从服务器加载的新信息,需要在UI上显示

有没有人遇到类似的问题,因此可能会给我一个例子,或者给我一些关于如何解决我的问题的最佳实践?我甚至不确定是否应该使用序列图,活动图或甚至其他类型.

帕斯卡尔,

这不是UML问题.这是一个设计问题.

UML只是帮助你

To understand hard and crtical section of your program/design and to
explore alternative solutions , while writing your code. with the power of visual modeling.

所以..

First, ask yourself what kind of parallelism or concurrency exist in
your problem? To investigate this:

Draw a simple activity diagram with partions in which each partions
used to represent different operating system threads or processes.The
object nodes can be used to model the shared objects and data.Forking can be used to model the creation and parallel execution of multiple threads or processes.

然后问自己(使用该图)

What are my shared data? What are my active classes? (threads)What kind of “concurency” problems” may
accour? What may go wrong? What are synronization points? etc..Based on this Explore different alternatives, designs.

你应该担心的最后一件事是UML及其sytax(符号).

最好的UML图表是唤醒你心中“提问”的愿望的图表.

起初忘了Uml.询问有关您问题的核心问题.如果你喜欢视觉建模,你的思维就像视觉思维一样,使用Uml来更好地理解和研究可能的设计解决方案.

UML无法为您设计……

网友评论