tags:

views:

47

answers:

3

Hey all,

I have this problem, my system is a clothes store which allows the customer to return the cloths he has bought only after one day of buying date.

Returning cloths is the use case ... but how can I represent the one day condition? I thought about using "Guard condition", what do you think?

+1  A: 

What you have here is actually two different use cases which share a common action.

You want to create a base use case of "Try to Return Clothes", and then extend that into two different use cases which generalize to it, eg:

  • Base Use Case is "Try to Return Clothes"
  • "After 1 Day" extends "Try to Return Clothes"
  • "Within 1 Day" extends "Try to Return Clothes"

Then you can in your sequence diagrams identify the results of these use cases, e.g. the customer who does it after one day is not allowed to have the return processed.

TreyE
A: 

conditional statements aren't used in use cases because the conditions consist of behaviour. Such an use case "Returning cloths" is weird. use imperative statements for your use cases like: "make registration" "fullfill order" etc.

Erhan Bagdemir
A: 

A few options, depends on how you choose to represent the flow of your Use Case.

  • Sequence Diagrams: UML has the idea of timers built in, see e.g. here. You could show the time expiring (i.e. end of return period) as the trigger for determining subsequent behaviour.
  • If you use an Activity Diagram, you could simply have a decision point with two routes out (<1 day since purchase / >=1 day since purchase). [This is I think the same as your guard condition suggestion].
  • If you use textual steps, put the "happy day" case in the main flow (probably less than one day" then add an extension to cover the exception flow (>1 day).

Example of the last one for clarity:

Main Flow

  1. Returned item received from customer
  2. Return date confirmed as less than maximum return interval (1 day)
  3. Customer refunded
  4. ...etc.

Exception Flow: Maximum return interval exceeded

2a. Return date confirmed as greater than or equal to maximum return interval

3 Whatever you do in this scenario...

Bottom line, there are options. Which to choose depends on your modelling preferences. But to answer your original question: a guard condition is perfectly acceptable.

sfinnie