clean-code-php icon indicating copy to clipboard operation
clean-code-php copied to clipboard

Interface Segregation Principle design flaw

Open namagi opened this issue 6 years ago • 4 comments

In ISP there are severe design flaws which clearly indicate you have no experience with goverment employees:

class Human implements Employee
{
    public function work(): void
    {
        // ....working  --> instance would likely throw UnknownOperationException
    }

    public function eat(): void
    {
        // ...... eating in lunch break --> entire working hours IS-A lunch break; it may or may not have anything to do with eating
    }
}

Also, in Good: Not every worker is an employee, but every employee is a worker. --> Again, you have not met goverment employees.

All this makes it confusing to grasp the concept for some instances :wink:

namagi avatar Mar 04 '18 11:03 namagi

You always can give another example in PR

peter-gribanov avatar Mar 05 '18 07:03 peter-gribanov

Surely this baseless issue is not serious, right? 😅

The example about ISP is an example of ISP. Not an example about working with private/govt. employees. It's succinctly explained without building an authentic, ready-for-production interface, haha.

which clearly indicate you have no experience with goverment employees:

I really believe this issue is a joke? haha

spacemudd avatar Mar 05 '18 08:03 spacemudd

Was laughing ... a bit :-) Besides, shouldn't it be class Employee implements Human?

But yes, I think somebody had success in being funny.

archfrog avatar Apr 10 '18 09:04 archfrog

Besides, shouldn't it be class Employee implements Human?

@archfrog no, because it is not a human in global context, but a human in context of employees.

peter-gribanov avatar Apr 10 '18 10:04 peter-gribanov