UML 序列图 - 如何表示实例化对象的方法参数
UML sequence diagram - how to represent method arguments that instantiate objects
我不确定如何在序列图中(在 Ruby 中)表示如下内容:
class FirstClass
def process
thing = SecondClass.new('string argument', third_class, 2)
end
def third_class
ThirdClass.new('another string argument',)
end
end
序列中的第一条消息是对 FirstClass 实例的调用,让我感到困惑的部分是如何表示 ThirdClass.new 作为参数传递给 SecondClass 初始值设定项。
基本上你只是展示了对象的实例化方式和顺序,而不是它们被分配的位置:
因此,首先创建 ThirdClass
,然后 SecondClass
并在其中传递 ThirdClass
参数。
我不知道确切的 Ruby 语法。所以 new
是一个占位符。其他语言需要 class 名称,Python 使用 __init__
,等等。但虚线箭头线显示这是一个对象创建。
我不确定如何在序列图中(在 Ruby 中)表示如下内容:
class FirstClass
def process
thing = SecondClass.new('string argument', third_class, 2)
end
def third_class
ThirdClass.new('another string argument',)
end
end
序列中的第一条消息是对 FirstClass 实例的调用,让我感到困惑的部分是如何表示 ThirdClass.new 作为参数传递给 SecondClass 初始值设定项。
基本上你只是展示了对象的实例化方式和顺序,而不是它们被分配的位置:
因此,首先创建 ThirdClass
,然后 SecondClass
并在其中传递 ThirdClass
参数。
我不知道确切的 Ruby 语法。所以 new
是一个占位符。其他语言需要 class 名称,Python 使用 __init__
,等等。但虚线箭头线显示这是一个对象创建。