Designing a sequence diagram for an auction system

2020-08-01 03:52发布

问题:

I'm currently working on a sequence diagram for an auction system which acts as the middleman between customers and companies.

However I'm having difficulty with the design of the system and would appreciate some guidance, especially as I seek to tighten up the UML diagram.

The entire idea behind the system is that the customer creates a booking via a mobile app which uploaded to the auction app where companies can bid for it. If a company wins a bid, the auction app gives them a price range in which they can give the customer a quote (i.e. if company A wins a bid to mow customer X's lawn, then the auction app sets a price range of $15-$20 for the job, and company A's quote has to be in between that range). The customer can then accept the quote and go ahead with the job or reject it.

Steps are as follows:

 1.   Customer creates a booking on booking app
 1.1  Booking app saves booking (recursive as customer can save more than one 
      booking)
 1.2  Job is uploaded to auction app where other companies can bid for it. In the 
      next step, a company will bid for job.

 In the event of an unsuccessful bid:

 2.   Company makes bid for job on auction application
 2.1  Message sent to company telling them that they failed to win the job

 In the event of a successful bid:

 3.   Company makes bid for job on auction application
 3.1  Message sent to company telling them that they won the job
 4.   Auction app sends price limit message for the job that the company has just 
      won (to prevent overcharging). In the next step, the company needs to set a 
      quote

 In the event that a customer rejects a set quote    

 5.   Company sets quote for the job that they won
 5.1  Auction app sends the quote message to the auction app
 6.   Quote displayed to customer on mobile application
 7.   Customer rejects the quote
 7.1  The rejection message is sent to the auction app
 8.   The rejection message is displayed to the company

 In the event that a customer accepts a set quote 

 9.   Company sets quote for the job that they won
 9.1  Auction app sends the quote message to the auction app
 10.  Quote displayed to customer on mobile application
 11.  Customer accepts the quote
 11.1 The acceptance message is sent to the auction app
 12.  The acceptance message is displayed to the company
 13.  End booking process

This is the UML diagram:

I have 3 questions:

  1. When BidSuccess=False (i.e. a company's bid for a job has failed), they can opt to bid for another job and win (therefore entering the BidSuccess=True branch). Is it possible to convey this on the sequence diagram. If so, then how?
  2. There appears to be a lot of redundancy in steps 5-13, could the sequence diagram be better designed here? How would I go about merging 5,5.1,6 and 9,9.1,10 but letting them return different results depending on CustomerAcceptQuote.
  3. Perhaps my biggest concern is whether or not I've put the loop/alt guards in place. I think I have used them correctly but please correct me if they are not.

Thanks for taking the time to read this.

回答1:

ad 3) As for the loop/alt in your diagram then their semantics is not clear, mainly because they don't nest properly (see http://www.uml-diagrams.org/sequence-diagrams-combined-fragment.html for examples)

ad 2) As for the redundancy you can use the UML sequence diagram - interaction use as in

ad 1, ad 2) Overall to show the branching while avoiding redundancy instead of sticking to the UML sequence diagram you may use features from the UML activity diagram, as shown in example of UML interaction diagram

...Interaction overview diagrams provide overview of the flow of control where nodes of the flow are interactions or interaction uses. UML 2.4.1 Specification in some places relegates these diagrams as interaction diagrams while in other places interaction overview diagrams are referred to as specialization of activity diagrams...

Actually according to UML 2.4 Diagrams Overview

..UML specification does not preclude mixing of different kinds of diagrams, e.g. to combine structural and behavioral elements to show a state machine nested inside a use case. Consequently, the boundaries between the various kinds of diagrams are not strictly enforced. At the same time, some UML Tools do restrict set of available graphical elements which could be used when working on specific type of diagram..


Disclaimer: original pictures (without the green and purple rectangles) come from Kirill Fakhroutdinov's online book www.uml-diagrams.org