Getter Method: Cheating the Spirit of The Law of Demeter
The Law of Demeter gives us suggestions on how to reduce coupling, but there are many loose ends from where we can break the clauses of the Law of Demeter. by
Join the DZone community and get the full member experience.Join For Free
Every time I look at the getter methods, I wonder; it s a simple getter method, but its impact is very high on the code.
Is it a friend for developers or an enemy who is acting as a friend?
We can discuss various topics on getter, but here I will focus on one topic, which impacts the codebase severely and forcibly implementing coupling and breaching the encapsulation.