uml - 主动类与被动类

标签 uml specifications class-diagram

在 UML 规范上层结构 2.5(仍为 Beta,第 203 页)中

A Class may be designated by setting isActive to true as active (i.e., each of its instances is an active object). When isActive is false the Class is passive (i.e., each of its instances executes within the context of some other object).


  • 我想知道是否有一个简单的例子说明了应用它们中的每一个的差异?
  • 并详细说明这个概念?
  • 最佳答案

    根据定义,

    Active Objects In UML, active classes, and therefore active objects, exist in their own thread of operations and have their own address space. If execution, or code activity, is thought of in terms of flow, active objects can start or control that flow. Active objects, in other words, are sequential and do something: modify variables, change program behavior, and so on. In UML, active classes and objects are distinguished by having a thicker border than passive objects.

    Passive objects in UML do not generally have the ability to modify or begin the flow of execution, because they must wait for another object to call them. Instead, passive objects are generally used to store information, and in many cases this information may be shared between multiple other objects. This may allow passive objects to be accessed concurrently, not sequentially. To make sure that the data contained inside has a high integrity, UML allows for passive objects to insist that they be accessed sequentially; if two threads attempt to call the same sequential passive object, that object can delay the second thread until the first has finished with it.



    可以找到一个有用的例子 Here

    关于uml - 主动类与被动类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14565544/

    相关文章:

    uml 2.0序列图: is a reply message obligatory when modeling a synchronous message

    css - 按钮内的字母位置与手机中看到的相同

    c# - .NET 的免费 UML 绘图库

    uml - 状态图与状态机

    java - 规范和政策之间的区别?

    java - 具有差异的 JVM 10 规范?

    c# - C# 中的异常处理是否与 ECMA-335 标准相矛盾?

    node.js - nodeJS Web 应用程序的 UML 设计

    java - 用 Java 实现 UML 图

    UML2 类图 - 用于泛化的嵌入式符号?