The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

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 (43) [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 :-/