Online Auction Object Oriented Design

Online Auction

  • 1. Seller: Will have minimum cost to sell for item = MinCostToSell
  • 2. Mediator: Mediator will be present inbetween bidders and seller.
    • Will start bids from 0, Will increase bids by constant value x. if no bids will expire in time=t.
if (bids < MinCostToSell) 
  - Will not sell item
  • 3. Bidders: Will be notified about auction by mediator
  • 4. External Product: autobidder This can autobid on behalf of bidder. Bidder need to purchase it.
    • if bidder is online, autobidder should be disabled.

Uses Mediator & Observer Design Pattern

1. Mediator Design Pattern

  • What? The pattern restricts direct communications between the objects and forces them to collaborate only via a mediator object.
  • Why? If the objects interact with each other directly, the system components are tightly-coupled that makes higher maintainability cost and hard to extend.
  • How?
object-1               object-2
       \               /
        Mediator-Object
            |
         Object-3

2. Observer Design Pattern

  • There is 1 SUBJECT & N OBSERVERS.
  • Whenever there is change in any value/state of Subject, then that must be notified to Observers. This duty of notification is done by Subject itself.
  • Subject maintains list of observer objects with itself.

[image

Source Code

Comments (0)