Question

I have made a Sequence diagram, and i want to know about it is well or not from this basic code

enter image description here

public void onClick(final View v) 
{
 r = new Runnable()
    {
        public void run()
        {
            if(running)
            {
            str2 = Ef.getText().toString();
            }

        }                                            
    };

}
Was it helpful?

Solution

On a sequence diagram you should mention the variable name and the class of each object. In your diagram instead of r you should name it as r : Runnable and do the same for the other objects. This is important because someone needs to know the type of each object participating in the sequence.

UML is meant to visualize code in order to improve people's understanding of it. Of course this is simple enough that you wouldn't need a sequence diagram in order to explain it. I guess that this is a learning example.

You should also replace the if with opt. In my opinion this is not so important, everybody would understand the if, but if this is something like a school assignment, then it's better to go formal.

There are a lot of books and articles about UML, this article can serve as quick reference for sequence diagrams, go to "http://www.ibm.com/developerworks/rational/library/3101.html".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top