marți, 22 decembrie 2015

Design Patterns: The principle of least knowledge (Law of Demeter)


The principle of least knowledge (Law of Demeter) - Talk only to your immediate friends
  • We should only invoke methods that belong to:
    • The object itself
    • Objects passed as a parameter to the method
    • Any object the method creates or instantiates
    • Any components of the object (HAS-A )
  • Reduces the dependencies between objects
  • Reduces software maintenance
  • Help with debugging

Niciun comentariu:

Trimiteți un comentariu