gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 05:58:50 27 4
gpt4 key购买 nike

Stackoverflow 上已经有一些主题与如何在 UML 中对不同的线程建模有关,例如:Is there an inituitive UML approach to depict threads .

但是我仍然觉得,我的案例还没有被讨论过,尽管它应该很常见:

我正在创建一个 iPhone 应用程序,其中显然有一个主 UI 线程,我还使用后台线程执行远程调用等。我基本上有 4 个不同的方面,我想在我的示 Intent :

  1. 向用户显示的 UI。
  2. Main-UI-Thread 正在执行的任务(因此阻塞了 UI)
  3. 后台线程执行的任务
  4. UI 更新,由 UI-Thread 执行,但可以由 Background-Threads 触发。例如:从Server加载新的Information,需要在UI上展示

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

最佳答案

帕斯卡,

这不是 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 及其语法(符号)

最好的 UML 图是能唤醒您心中“提问”欲望的图。

首先忘记 Uml。询问有关您的问题的核心问题。 如果您喜欢视觉建模并且喜欢视觉思维,请使用 Uml 来更好地理解和研究可能的设计解决方案。

UML 不能为你设计...

关于iphone - UML:如何为移动应用程序(iPhone/iOS、Android)建模 UI 和后台线程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6623964/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com