Re: Assigning responsibility for cancelling an Order

"Greg Young [email protected] [domaindrivendesign]" <[email protected]>
Newsgroups gmane.comp.programming.domain-driven-design
Message-ID <CAC9RQtg3KkGFvXBQFoLP-utnU0yOP-P2=t94pQjxTc4DAm=KFA@mail.gmail.com>
Which is a result of which?

Is it decreasing the quantity cancels the order or canceling the order
decreases the quantity?

This sounds like a historical issue due to a poorly implemented crud system.

On Tuesday, August 19, 2014, [email protected] [domaindrivendesign] <
[email protected]> wrote:

>
>
> During a conversation with our Domain Expert we can across this feature:
>
> "A Customer service agent can cancel an Order by decreasing its quantity.
> To cancel an Order we decrease its quantity by the specified quantity,
> change its status to either partially cancelled or fully cancelled and log
> the CS agent who issued the cancellation."
>
>
> We are currently split between several solutions (assuming we have the
> `agentId`, `orderId` and `cancelledQty` from the request):
>
>
> **Solution 1:**
>
>
>     CSAgent agent= (CSAgent) EmployeeRepository.getById(agentId);
>
>     Order order= OrderRepository.getById(orderId);
>
>     agent.cancel(order,cancelledQty);
>
>
> vs
>
> **Solution 2:**
>
>
>     CSAgent agent= (CSAgent) EmployeeRepository.getById(agentId);
>
>     Order order= OrderRepository.getById(orderId);
>
>     order.cancel(cancelledQty,agent);
>
>
> **Solution 1** really captures what the requirements is conveying and
> reads really well; however, **solution 2** seems more natural when coding
> the implementation of the cancel() method as I'll mostly update fields in
> the `Order` class itself which I hope to keep `private` with no public
> setters.
>
> The only thing I need from the `CSAgnet` class is a snapshot of its data
> to be stored with the `Order`.
>
>
> So how should I determine the best course of action from a DDD perspective?
>
>  
>


-- 
Studying for the Turing test
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.