self message(non recursive) vs self recursive message

做~自己de王妃 提交于 2019-11-27 21:12:03

问题


What is the difference of these two messages? I searched the web a bit and most what I could find is

A self message is a message that an object sends to itself. It is a message that represents the invocation of message of the same lifeline. A self message can represent a recursive call of an operation, or one method calling another method belonging to the same object.

What is the benefit of additional activation bar that recursive message brings?

In graphical notation:

non recursive self message:

recursive self message

what is the difference?


回答1:


You should use a self message when you are calling functions in the class which either don't call other functions, don't send any messages (or they do but you don't want to show this in the sequence).

If you also want to model how the inner functions of the class interact with other lifelines, you have to use recursive calls to show this, otherwise the reader can't know that the messages are sent/received from the inner function.



来源:https://stackoverflow.com/questions/11626473/self-messagenon-recursive-vs-self-recursive-message

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!