【发布时间】:2021-05-18 13:19:20
【问题描述】:
我的代码如下:
class Synchronization
def initialize
end
def perform
detect_outdated_documents
update_documents
end
private
attr_reader :documents
def detect_outdated_documents
@documents = DetectOutdatedDocument.new.perform
end
def update_documents
UpdateOutdatedDocument.new(documents).perform
end
@documents 是我从DetectOutdatedDocument 中的方法返回的哈希数组。
然后我使用这个 Hash 数组来初始化 UpdateOutdatedDocument 类并运行 perform 方法。
这样的事情正确吗? 还是我应该使用关联或其他方式?
【问题讨论】:
-
您的代码中只有一个类,但您的图表中有三个。这不可能。
-
除了加载顺序依赖外,这些类之间没有显示任何关系
-
您能澄清一下您的问题吗?您的代码中只有一个类,因此所提出的问题实际上没有意义。
标签: ruby uml class-diagram