I have thought of this for a while and I want to know what you think about this. This is more of a way to structure the code that might not be 100% object oriented and that is not the purpose. I would like to divide the code into Data, UseCases and HelperMethods
- Data should be more clean (or "anemic", if you will) objects
- UseCases (or business flow) would map to a specific use case
- HelperMethods is for pure function that helps the UseCase look cleaner, but is not generic, the logic is mostly used in the usecase. This could have been private static in the UseCase-code, but then you cant use it fluent syntax and you cant unit test them
Example
Data
Customer
{
public string Name{get;set;}
...
}
UseCase
GiveCustomerDiscount
{
// Read data from db with repo, about customer, previous orders, "isFridayBlack", and so on
// Process data for customer with help from helper methods that takes data as input and
// what kind of discount as output
// Update Customer with repo
}
HelperMethod
// Takes a customer and data and calculates a discount
// "Exposes" Extension methods and public static methods
So question: Is this good coding style? Will it bite me, as code base increases? Can I get some more information about this approach or similar?