Michael Jordan (2) [Avatar] Offline
#1
In reference to refactoring the Order Service in Chapter 6, if one were to implement CancelOrder, would it go into a separate service or would OrderService be changed to support both OrderApproved and OrderCancelled events? If the OrderService were to support both operations, then would it be best to use the Facade pattern where the INotificationService could be extended to include both operations?
Steven van Deursen (15) [Avatar] Offline
#2
This is a topic that will be discussed in detail in chapter 10 "Aspect-Oriented Programming". The short answer is, that there should likely exist no OrderService class at all in your application (since that violates OCP, SRP, and ISP), but only service classes with one public method. So you should typically have a CancelOrderService, ApproveOrderService, ShipOrderService, MakeOrderService, etc.

I won't go into more details here, since chapter 10 spends about 30 pages on this exact topic. So this is a major teaser, but you'll have to wait until chapter 10 :-/