1

We are arguing with colleagues how to name a method:

ProcessInstructions vs ProcessInstructionsHavingDeliveryInProgrssStatus

Those who insist on the first name say that it is more generic, and does not reveal internal implementation. Furthermore, second name is really awkward.

The other half prefers the second name. Despite it is long (and ugly) it clearly states the expectation of the business. Processing is available only for instructions which status is DeliveryInProgress.

So, in essence, the dispute is about which kind of information should and should not be revealed be the names. Contracts should be stable vs Contracts should be continuously refactored to reflect domain.

Both approaches seem to be of equal importance.

What does DDD tell about this?

2

DDD tells you to define your business language.

I can't believe anyone says

"Process the instructions (on this order?) which require the delivery to be in progress!"

surely they would say:

"Process the instructions!"

"We can't, the delivery is not in progress"

Really, ive also got to question if anyone would say "Process these instructions!" at all, it seems so generic. surely they would say: (lets assume you are talking about orders and tracking)

"Update the tracking information on the order!"

"we cant! its not out for delivery yet!"

so you would have

/// <exception cref="NotOutForDelivery">Thrown when order isnt out for delivery</exception>
Order.UpdateTrackingInformation()

Or maybe once an order is 'out for delivery' you call it a delivery instead? then you would have the interface segregation you want

var delivery = Order.Send()
delivery.UpdateTrackingInfo(trackinginfo)
  • We usually 'can'. As workflow of the statuses is the following: DeliveryInProgress -> Verified/PendingMaual/Rejected. PendingManual implies the situation when intervention is required after which status can be set again to DeliveryInProgress. Verified status assignment triggers further processing. Hence, it sound more like Process all that requires processing and tell us about problems. – Pavel Voronin Sep 9 '16 at 10:18
  • hmm I think you are getting trapped by the technical implementation. sure you might have 'order processing', but that would be high up in the namespace. There must be a set of things you do to an order in PendingManual state, you can name those things and put them in services, subclassed Order objects by state Methods, or just put them all as Order methods and throw exceptions when the state is wrong – Ewan Sep 9 '16 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.