News for hackers. Stuff that matters.
Re:Law of Demeter and immutability by xsmasher on Friday September 30, 2016 @05:13PM (#12615322)
End goal is to make code that is easier to maintain and understand.

The intermediate goals should be to reduce coupling, increase encapsulation, etc. These are tools to achieve the end goal.

Multiple dots is just a code smell, indicating that you're probably not meeting your intermediate goals or the end goal. If you see multiple dots, you should probably examine that code to see if it "wants" to be somewhere else, in service of the Primary goal.

But if you elevate "multiple dots" to the level of a "Law" then you're looking at the problem from the wrong end, and are in real danger of losing sight of the end goal. You can follow this law right down a hole that works AGAINST your real goal.

There are no comments on this comment yet.