A high-level module is an interface / abstraction that will be consumed directly by the presentation layer. A low level, on the other hand, is a bunch of small modules (subsystems) that help a high level do its job. The example below is a high-level module. I excluded dependency constructor injection for a shorter sample.
public class OrderService : IOrderService { public void InsertOrder(Order ord) { if(orderValidator.IsValidOrder(ord) { orderRepository.InsertNew(ord); userNotification.Notify(ord); } } }
And one of the low-level modules ( OrderValidator ):
public class OrderValidator : IOrderValidator { public bool IsValidOrder(Order ord) { if(ord == null) throw new NullArgumentException("Order is null"); else if(string.IsNullOrEmpty(ord.CustomerId)) throw new InvalidArgumentException("Customer is not set"); else if(ord.Details == null || !ord.Details.Any()) throw new InvalidArgumentException("Order detail is empty"); } }
Fendy source share