The downside is a number of "pass through" methods that do nothing but forward the message to the next child object... Like many OO guidelines, it's probably impossible and impractical to follow this one 100% of the time. The balance between spreading knowledge and adding overhead is a judgment call but I generally vote for more encapsulation until the overhead becomes too painful.http://www.ccs.neu.edu/research/demeter/demeter-method/LawOfDemeter/LawOfDemeter.htm
Showing posts with label Law of Demeter. Show all posts
Showing posts with label Law of Demeter. Show all posts
Saturday, October 26, 2013
Downside of Law of Demeter
Author indicates pass through methods (or new parameters added just to pass through?) are a necessary evil of LOD:
Sunday, September 1, 2013
Law of Demeter
The issue here is that LoginPage is breaking a the Law of Demeter. LoginPage is asking for the Database even though it itself has no need for the Database (This greatly hinders testability as explained here). You can tell since LoginPage does not invoke any method on the Database.
Subscribe to:
Posts (Atom)