A market consists of agents playing buyer, seller, and broker roles. Brokers are like yellow page servers. Sellers register their goods and services with a broker. Buyers make inquiries to brokers to learn the identities of sellers selling needed goods or services.
Once introduced, the buyer and seller negotiate a price. If a price is agreed upon, then the seller performs the service or hands over the product in exchange for money.
There are several variations of this protocol:
1. The broker acts as an intermediary between the buyer and seller, forwarding offers and counter-offers. The buyer and seller never need to know each other's identity. The broker may earn a commission for this service.
2. After a price is agreed upon, an agent playing the role of accountant holds the money in escrow until the services are performed to the buyer's satisfaction.
3. No agents are brokers. Sellers are stationary while buyers are mobile and wander around the market randomly. Sellers broadcast their wares through advertising and/or buyers broadcast their needs. For example, a market often appears outside of a concert or sports venue. Buyers shout "I need tickets" while sellers shout "Anyone need tickets?"
Example: A farmer's market is a good example. Sellers (farmers) operate from stationary stalls. Signs above the stalls advertise what they sell (fruit, vegetables, massages, etc.) Buyers wander around looking for the goods and services they need. When a buyer finds a seller they barter. If they agree upon a price, then money is exchanged for goods and services.
Agents that play Buyer and Seller roles are called traders:
A seller registers his services and/or products with a broker. A buyer asks the broker for the identity of any agents selling certain goods and services. Upon learning the identity of a seller, the buyer offers the seller a price. If the price is above the smallest amount the seller is willing to accept, then the seller agrees, otherwise, if the price is below the largest amount the buyer is willing to pay, the buyer increases the price and the process repeats. If a price is agreed upon, then the service is performed and/or the product is returned to the seller.
A variation of this interaction allows the seller to make a counteroffer to the buyer. How should our sequence diagram be modified to show this?