piotrplenik / clean-code-php

:bathtub: Clean Code concepts adapted for PHP
MIT License
12.28k stars 2.28k forks source link

Interface Segregation Principle design flaw #147

Open namagi opened 6 years ago

namagi commented 6 years ago

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:

peter-gribanov commented 6 years ago

You always can give another example in PR

spacemudd commented 6 years ago

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

archfrog commented 6 years ago

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

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

peter-gribanov commented 6 years ago

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.