Layering Design Pattern in Java clean code style
- by zeraDev
As a Java developer, I am developing trying to use the clean code rules. But in my team we are facing a concrete problem:
We have a business layer offering a service called "createObject", this service makes a lot of operation which can result to problem. E.g: parentObjectDontExist, objectAlreadyExist, dontHaveAuthorizationToCreate, operationFailed...
and we want the UI using this service to display different information messages depending which error occurred.
In old java dev, we should have create all signed exception type and throw it in createObject.
As Clean code says, it is forbidden to use Exception for business logic AND signed exceptions are evil...
Why not...But i don't know how to solved this problem and i don't want to use return code.
How do you do?
Thanks for youre experience return.