lundi 30 mars 2020

Design pattern suggestion for system with multiple scenarios

I am working on a scenario, where I have a list of orders.
Order DTO:

public class Order{
  private int orderId;
  private String orderType;
  private String orderingSystem;

  ... GETTER & SETTERS
}


  • orderTypes can have NEW,EXCHANGE,RETURN possible values.
  • orderingSystem can have INTERNAL_SYSTEM, EXTERNAL_SYSTEM possible values.

Based on the orderType & orderingSystem I have to process every order.

Common business to be applied on every order:

  1. Order validation.
  2. Order Enrichment
  3. Execute ordering algorithm(will vary on the orderType & orderingSystem).
  4. Finally persist the list of processed orders into DB.



Possible combinations can be

  1. NEW order with INTERNAL_SYSTEM
  2. NEW order with EXTERNAL_SYSTEM
  3. EXCHANGE order with INTERNAL_SYSTEM
  4. EXCHANGE order with EXTERNAL_SYSTEM
    & so on..



How can I design my application to accommodate each and every possible combination?

Aucun commentaire:

Enregistrer un commentaire