I'm kind of in an impasse here.
Lets say I have module A which exposes some methods returning objets and module B that uses said methods from Module A. Module A will have situations when it will have to return Nothing.
The problem is: Of course I don't want to return Nothing. Many, many books, top-coders and heuristics will tell you. However, the use of exception is not allowed due to massive use of Module A. That would apparently kill performances.
At last, we do not want to use auto-instanciated objet and have to check inside state to know if it's in fact Nothing (like a check-null...)
What would be an alternative for Module A to expose it can return something empty (or nothing) and for everyone using it like Module B to be needed to check such case (like signed exceptions try-catch)?
Any help will be really appreaciated! I'm pretty much out of solution and I want to do something clean that will be able to evoluation without causing unwanted behaviours and errors. Thanks
To close this question, project managers decided to return Nothing everywhere. They accept to have some production crash due to forgotten nothing-check... From what I gathered during this timelaps, I'd say that the best alternative would be the Try-object patern, because it forces the client to check the why is the return a boolean and how to use the call... at least on first use.