We have moved to a more SRP model and found coming up with class names challenging. Previously we had a Order class that looked something like this:
public class Order
{
public void Create()
{
}
public void Dispatch()
{
}
public void Cancel()
{
}
}
We are now splitting these 3 methods into seperate classes so they look like what i have described below:
public class OrderCreation
{
public void CreateOrder(OrderDTO order)
{
}
}
public class OrderDispatch
{
public void DispatchOrder(OrderDTO order)
{
}
}
public class OrderCancellation
{
public void CancelOrder(OrderDTO order)
{
}
}
Is the naming of these classes and public methods sensible? Do they follow what naming should look like in a business logic or domain class? (Remember we are following SRP)
UPDATE: The classes have been modified so they are not anemic. Based on feedback we think this is a better solution.
public class OrderCreation
{
public string CustomerName {get;set;}
public string CustomerEmail {get;set;}
public string Address {get;set;}
public void CreateOrder()
{
}
}
public class OrderDispatch
{
public string OrderNumber {get;set;}
public string Courier {get;set;}
public void DispatchOrder()
{
}
}
public class OrderCancellation
{
public string OrderNumber {get;set;}
public void CancelOrder()
{
}
}