UML Modeling – How to Model Optional Use Cases in UML

modelingumluse-case

Let's say, I want to model an application which allows users to model class diagrams. The high level use case can be modelled as UC1:Model Class Diagram, which refines itself into UC11: Model Class, UC12: Model Connection, UC13: Model Composition, etc.

Since UC11, 12, 13 are part of UC 1, I used the include-Association. Unfortunately, the UML specification says that included use cases are essential parts and if you would leave one of them out the high level behavior could not be achieved any more.

But in this example a valid class diagram can be created without modelling a connection or a composition, so these use cases are optional.

To boil it down to an essence: How can optional use cases be modelled in UML while providing a mechanism for reuse (like the include association)?

Best Answer

You could use Extend in this case.

Example include and extend: UC “login” includes UC “sign up”: The login page can be accesses straight away, but if you haven’t signed up the alt path would lead you to the sign up page . You must complete this UC to get through. You can assess the sing up page directly as well. So for reuse you could make this two use cases, instead of an alt path and include the sing up UC.

UC “edit profile” extends UC “login”: The UC “Login” always has a pop-up when you login to ask if you want to change your profile. You don’t have to do this to accesses the site. You can accesses the profile edit page from several places, with its own UC of course. You would draw this relationship as an extend because its optional to get through.

Related Topic