5

I am trying to draw a UML use-case diagram to model requirements for a software project.

The two requirements I have issue to model are:

  1. TravelAgent creates a booking for a [old] client who is requesting a home.

  2. When a new client wishes to make a booking, the TravelAgent register him/her to the system before doing the booking.

I have two approaches to model these requirements:

  1. Modeling the first use-case as a sub-procedure of the second use-case (Figure 1).
  2. Extending the first use-case (Figure 2).

Both approach imply that the first use-case could be perform independently, but when the second use-case is executed, the first one MUST be executed too.

Are they actually same and both correct?

P.S. As another question, since the NewClient converts to a Client after the registration, should I show the NewClient as subclass of Client or something?

Figure 1 Figure 1

Figure 2 Figure 2

2 Answers 2

2

Beware that extend is used in UML quite differently than in e.g. Java.

Your diagrams are probably not expressing what you would like them to. You used the generalization relationship (the arrow with a hollow triangle). This implies a "is a" relationship. But clearly neither is "Register a client" a case of "Create a booking" nor the other way round.

The correct way to indicate a "include" or "extend" relationship is with a dashed line e.g. - - - > . Now the difference between the two is the following. Suppose A includes B. This means that whenever somebody does A she will do B too. On the other hand, if A extends B, than whenever somebody does A, B has nothing to do with it. But if you do B, you might do A additionally during the course of B. You should specify a condition under which A actually extends B.

In your case you could actually use both as long as you indicate in the condition of the extends version that this depends on the customer being new.

About your modeling of the new client. I do not believe that there is much value in expressing the difference between the two here. BTW "subclassing" is not the correct term, it is (again) generalization. Adding such a generalization implies that every new customer is a customer and can do whatever a regular customer can do. I cannot decide if this is what you want.

0

All that I've learned about INCLUDE and EXTENDS in UML diagrams is that include is something that it is required and extends is optional. In your case, it is supposed that the client already is registered and logged in the system. So, he doesn't need to do a register again. But the newClient has to be registered to create a booking. I think it could look like this:

Example

But I'm not sure, once I'm also learning... I hope it helps.. Good Luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.