Professional Documents
Culture Documents
Single Responsability PDF
Single Responsability PDF
(responsabilities). Adding new methods will modify the class without a good
reason.
@Override
public String toString() {
return "I am a employee";
}
}
Let’s refactor, so that the responsibility of the class GoodEmplyee is to define an employee, and the
other functionalities are delegated to dedicated services.
public class GoodEmployee {
String status;
String name;
int hours;
public EmployeePaymentService(EmployeeAdditionalPaymentService
employeeAdditionalPaymentService) {
this.eAPS = employeeAdditionalPaymentService;
}