Abstract/concrete class separation at sequence diagram

user487772 picture user487772 · Dec 27, 2014 · Viewed 7.4k times · Source

Is there a way to separate abstract class and it's concrete branches at a sequence diagram?

My use case is that some transactions must hit methods implemented in abstract class and some from its concrete implementations.

Or it is a concern of a class diagram and not a sequence diagram?

Answer

Geert Bellekens picture Geert Bellekens · Dec 29, 2014

In your sequence diagram you should only use objects of the types you know them to be at that particular point in execution.

Then you call the method on that object, even if it is a method implemented on the abstract parent class.

Sequence diagrams are very much like code int hat respect.

So suppose you have following situation: Class diagram

Then you call both the implemented as the abstract operation on an object of ConcreteSubClass, because your user class has an association to ConcreteSubClass, regardless of where the operation is implemented.

Sequence diagram

If the User class had an association to the AbstractClass then you call the operations on an object of type AbstractClass