Is an order something transient or not

71 views Asked by At

In my company (train company) there is a sort of battle going on over two viewpoints on something. Before going to deep into the problem I'm first going to explain the different domains we have in our landscape now.

Product: All product master data and their characteristics. Think their name, their possible list of choices...

Location: All location master data that can be chosen, like stations, stops, etc.

Quote: To get a price for a specific choice of a product with their attributes.

Order: The order domain where you can make a positive order but also a negative one for reimbursements.

Ticket: This is essentially what you get from paying the order. Its the product but in the state that its at, when gotten by the customer.

The problem

Viewpoint PURPLE (I don't want to create bias)

When an order is transformed into all "tickets", we convert the order details, like price, into the ticket model. In order to make Order something we can throw away. Order is seen as something transient. Kind of like the bag you have in a supermarket. Its the goods inside the bag that matter. Not the bag itself.

When a reimburse flow would start. You do not need to go to the order. You would have everything in the Ticket domain. So this means data from order will be duplicated to Ticket.

But not all, only the things that are relevant. Like price for example.

Viewpoint YELLOW (I don't want to create bias)

You do the same as above but you do not store the price in Ticket domain. The ticket domain only consist of details that are relevant for the "ticket" to work. Price is not allowed in there cause its a thing of the order. When a reimburse flow would start, its allowed to go fetch those details from the order. Making order not something you can throw away as its having crucial data inside of it.

The benefit here is that Order is not "polluting" the Ticket with unnecessary data. But this is debatable. The example of the price is a good example.

I wish to know your ideas about these two viewpoints.

1

There are 1 answers

2
jgauffin On

There is no "Don't repeat yourself" when it comes to the business domain. The only thing that dictates the business domain is the business requirements. If the requirements state that the ticket should work independent of the order changes, then you have to duplicate things.

But in this case, the requirements are ambiguous. There is no correct design using the currently specified requirements. Building code based on assumptions is the #1 way of getting bad code, since you most likely will have to do a redesign down the road.

You need to go back to the product owner and ask him about the difference between the Order and the Ticket.

For instance:

  • What should happen to the ticket if the order is deleted?
  • What happens to the order and/or ticket if the product price changes?
  • What happens to a ticket if the order is reimbursed?

Go back, get better requirements and then start to design the application.