What are (if any) implied assumptions or limitations and design differences, such as:
A):
class SampleClass1 { IWorker workerA; IWorker workerB; void setWorkerA(IWorker w); void setWorkerB(IWorker w); WorkResult doWork(); }
B) compared to this:
class SampleClass2 { WorkResult doWork(IWorker workerA, IWorker workerB); }
I know this depends on the specific project, but what if the above class is part of a small structure? The first class is able to maintain state and separate the steps more naturally, but the second class provides “real-time communication” with the external caller in a more natural way, since the worker is transferred every time doWork () is called.
Are there any recommended uses or general methods that determine the choice between the two above methods? Thanks.
class-design
Paralife
source share