UML 序列图 - 如何表示实例化对象的方法参数

Rob*_*ldo 7 ruby uml sequence-diagram

我不确定如何在序列图中(用 Ruby)表示如下所示的内容:

 class FirstClass
   def process 
       thing = SecondClass.new('string argument', third_class, 2) 
    end 

   def third_class 
       ThirdClass.new('another string argument',)
   end
 end
Run Code Online (Sandbox Code Playgroud)

序列中的第一条消息是对 FirstClass 实例的调用,而让我困惑的部分是如何表示 ThirdClass.new 作为参数传递给 SecondClass 初始值设定项。

qwe*_*_so 6

基本上,您只是显示对象的实例化方式和顺序,而不是它们的分配位置:

在此输入图像描述

因此,首先ThirdClass创建,然后SecondClass传递参数ThirdClass

我不知道确切的 Ruby 语法。所以new是一个占位符。其他语言需要类名,Python 使用__init__等。但虚线箭头表明它是一个对象创建。