I have a really awfull class with two methods that start or stops some services when that services are available. Something like the following (they are not if-elses, just if):
void startServices() {
if (service1 == true) {
start1();
}
if (service2 == true) {
start2();
} if (serviceN == true) {
startN();
}
}
void stopServices() {
if (service1 == true) {
stop1();
}
if (service2 == true) {
stop2();
}
if (serviceN == true) {
stopN();
}
}
你们是否推荐我任何设计赞助人,使其成为主人?
感谢!