Difference between types of messages in sequence diagrams

偶尔善良 提交于 2019-12-06 04:20:12

问题


What is the difference between?

Self message Recursive message Re-entrant message

thanks


回答1:


A Self Message is a type of message which represents the execution or operation call in the same object lifeline.

A recursive message is a type of self message that is executed recursively.

A re-entrant message is where you have an object A and and oject B.

  • A makes a call C to B
  • B needs some data from A to complete call C
  • B sends a message to A get the data required to complete call C

The call that B makes to A is called a re-entrant message.

Hope that makes sense!!!




回答2:


The result of a call to E function is used to complete a call to another function in the same lifeline with the E function.

Example: Function Main from lifeline of ControllerC object colect data from EvaluateStudent function (located in StudentC scope) in order to use it as parameter for a call to another function also located in the same scope of StudentC. It is importent that the calls to be performed from outside the scope of StudentC. In our case the calls are performed from ControllerC.

public StudentC
{
    public function int EvaluateStudent(object student) 
    {
       /*... perform complex evaluation here ...*/ 
    }

    public function int IsTopStudents(int score, int acceptanceLevel)
    { 
       return(score > acceptanceLevel); 
    }
}

public ControllerC{     
    Public function Main()
    {
       IsTopStudent(EvaluateStudent(student), 8);
    }
}


来源:https://stackoverflow.com/questions/2980176/difference-between-types-of-messages-in-sequence-diagrams

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