Skip to content

Demeter's Law #9

@vagosdim

Description

@vagosdim

Avoid:
o.getSubPart100().getSubpart12().getsubpart17().doSth();

Do: make class subPart100 to export a facade method

  • dosthWithSupart12And17();

s.t. the clients DO NOT depent on
(a) subPart100
(b) subPart12
(c) subPart17
(d) result of doSth()

/* iteratively, the subPart classes can do also a facade method for the work of their components */

Demeter: a class should depend only on its attributes + IMMEDIATE collaborators

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions