0

I'm modeling an Online Classified System where, naturally, who sells also can buy and vice-versa.

The question is: should I have two different Actors, Buyer and Seller or I could have, say, an actor Client capable either buy and sell?

How do you approach this Model?

Cheers,

2
  • 1
    I modeled an approach to your domain on this question. To summarize. There is a difference between a Person and the Roles they play within your system. In your case, the Actor is your Person (or for further clarification, a Person who already has a role of "RegisteredUser"). On both sides of the "Listing" transaction is the "Seller" and the "Buyer" these are two roles that can be applied to a "RegisteredUser" May 16, 2014 at 15:12
  • As I mentioned in the other question, having these separate Roles applied to your actors, allows you to ask questions like "How many listings has UserX created" or "How many times has UserY purchased a product" without clouding your "RegisteredUser" object with those concerns, he can Ask his "Seller" or "Buyer" roles to provide the answers. May 16, 2014 at 15:12

2 Answers 2

2

I'd say buying and selling are actions that do not define an object. You actually have a Person who can either buy or sell things; buying and selling would be interfaces:

interface iBuyer
{
    void Buy();
}

interface iSeller
{
    void Sell();
}

public class Person: iSeller, iBuyer
{
    ...
}
1
  • 1
    How does this address modeling the use cases in UML?
    – Thomas Owens
    May 16, 2014 at 15:29
1

If somebody is buying and somebody is selling, then you have two actors. They may be of the same "type", but they are still separate actors.

3
  • 1
    Where from can I learn about this concept "actors"
    – dole doug
    May 15, 2014 at 20:50
  • Have a read up on Use Case Diagrams in UML. Do a search on the uml.org web site for examples and tutorials.
    – Simon B
    May 16, 2014 at 13:07
  • @doledoug there are plenty of good uml books at amazon ;) May 18, 2014 at 12:55

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.