oop - Object Oriented Design Suggestion required -
oop - Object Oriented Design Suggestion required -
i need suggestion on ood. below situation.
class a{ private b service_; private stopwatch timer_; private const int mintimetowait; public someoperation(){ timer_.start(); //call method on service_ async , subsribe event callback } private someoperationcallback() { timer_.stop(); int elapsedtime = timer_.elapsedtime(); if(elapsedtime < mintimetowait) thread.sleep(mintimetowait - elapsedtime) //continue after thread resumes } }
i have class fires async operation, , after async operation returns need check if asycn operation returned in less mintimetowait, if yes wait mintimetowait completes , proceed other operations.
now, doing right thing including logic check times , wait in someoperationcallback, or should create new class encapsulates logic , stopwatch , utilize class check , wait?
thanks in advance replies.
i not see problems approach. issue looks more name 'a', maybe 'minwaitprocess'. responsibility ensure process waits minimum amount of time.
now, doing right thing including logic check times , wait in someoperationcallback, or should create new class encapsulates logic , stopwatch , utilize class check , wait?
if did that, suspect have class a.
oop object-oriented-analysis
Comments
Post a Comment