Re:Removing jQuery from GitHub.com frontend
by Raglov on Thursday July 26, 2018 @04:29AM
(#17615936)
It's rather ironic how in object-oriented programming chaining is considered a bad practice, e.g., breaking the Law of Demeter.
[ Parent
| on HN ]
Re:Removing jQuery from GitHub.com frontend
by andybak on Thursday July 26, 2018 @07:53AM
(#17616703)
> breaking the Law of Demeter
How so?
You have an instance. You're allowed to call methods or access properties of that instance. You're not supposed to call methods or access properties of properties.
So chaining is just:
$foo.something().somethingelse().blah();
At each point you're getting a new instance and accessing that. You're never reaching inside of a property of that instance.