---
title: "Discussion on \"Demeter's Law: Don't talk to strangers!\" | Hashnode"
description: "Discussion on \"Demeter's Law: Don't talk to strangers!\". The Law of Demeter (LoD) or principle of least knowledge is a design guideline for developing software, particularly object-oriented programs\n— Wikipedia*\n\nThis law was proposed by Ian Holland in 1987 when he and his colleagues were\nprogramming a sys..."
url: "https://hashnode.com/posts/demeters-law-dont-talk-to-strangers/5d2ed70decb6290c096825b0"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Demeter's Law: Don't talk to strangers!](https://carlillo.hashnode.dev/demeters-law-dont-talk-to-strangers?utm_source=hashnode&utm_medium=feed)

The Law of Demeter (LoD) or principle of least knowledge is a design guideline for developing software, particularly object-oriented programs — Wikipedia\* This law was proposed by Ian Holland in 1987 when he and his colleagues were programming a sys...

Jul 17, 2019 · carlillo.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#beginners](https://hashnode.com/tag/beginners)
-   [#clean-code](https://hashnode.com/tag/clean-code)
-   [#programming-ciovqvfcb008mb253jrczo9ye](https://hashnode.com/tag/programming-ciovqvfcb008mb253jrczo9ye)

## Written by

[Carlos Caballero](https://hashnode.com/@carlillo)

@carlillo · Málaga, Spain

  
[View profile](https://hashnode.com/@carlillo)

Computer Science,JS/TS, Angular, web tech., Java/.Net, TDD/BDD, Agile, DevOps ...

I&#39;m PhD. in Computer Science from Málaga, Spain. Currently, I am teaching developers and degree/master computer science how to be experts in web technologies and computer science.

## Responses 3

Markdown supported · ⌘↵ to post

[Albina Konovalova](https://hashnode.com/@Albina1223)

[Apr 28, 2022](https://hashnode.com/posts/demeters-law-dont-talk-to-strangers/5d2ed70decb6290c096825b0/comment/626a7ff67d5d27b992e4be7b)

Hi fellas! I want a bit of advice myself for future lawyers. If you wish to reach more prospective clients and get more phone calls to your law office. You need the right SEO agency specializing in [SEO for lawyers](https://dnovogroup.com/seo-for-lawyers/) and law firms. SEO agency helps you rank higher in Google SERPs than your competitors and get leads from local search, blog articles, directories, etc. So, if you be a rich lawyer, I think you already know what you need to do;)

[Jerome Harley](https://hashnode.com/@jerome345)

[Mar 18, 2022](https://hashnode.com/posts/demeters-law-dont-talk-to-strangers/5d2ed70decb6290c096825b0/comment/62343f85bef4c71aa6f0da66)

Hello everyone, Great post. The time has come that every person should have a lawyer who will help and advise his client in any situation. And if you haven’t found a good lawyer yet, then you need to contact [Paul Mankin](https://www.paulmankin.com/) .

[Mark](https://hashnode.com/@mverleg)

[Jul 17, 2019](https://hashnode.com/posts/demeters-law-dont-talk-to-strangers/5d2ed70decb6290c096825b0/comment/5d2f138db17fc0c01b7ea9b2)

I've tried to be really strict about this for a little while, but I found that in some cases it's just too hard and not really worth the effort.

Have others had the same experience?

I still think it's a good guideline, but I consider it more a "Guideline of Demeter" than "Law of Demeter".

Famous example, is accessing the pages of a book through the book reference really a problem? It's not really an "implementation detail", it's just how books work, shouldn't it be considered part of the API?

[Carlos Caballero](https://hashnode.com/@carlillo)

[Jul 17, 2019](https://hashnode.com/posts/demeters-law-dont-talk-to-strangers/5d2ed70decb6290c096825b0/comment/5d2f138db17fc0c01b7ea9b2#reply-5d2f47e0f55547c1319b71c1)

Hi!

In computer science the laws are dangerous. In my opinion, each law/technique should be taken as an advise.

Thanks

[Joseph S Stevens](https://hashnode.com/@josephscottstevens)

[Jul 17, 2019](https://hashnode.com/posts/demeters-law-dont-talk-to-strangers/5d2ed70decb6290c096825b0/comment/5d2f138db17fc0c01b7ea9b2#reply-5d2f87f25537f88b7db8b739)

At least, laws and "best practices" are a reasonable starting point \\ safe assumption. But there are certainly cases where "best practices" are abused. Don't repeat yourself is one of the worst offenders in my book. Please don't wire EVERYTHING together. O\_o Obviously, config \\ and settings + constants shouldn't be repeated everywhere. But the number of classes I have seen cobbled together into a super class, in the spirit of DRY. _old man grunt_

[Mark](https://hashnode.com/@mverleg)

[Jul 18, 2019](https://hashnode.com/posts/demeters-law-dont-talk-to-strangers/5d2ed70decb6290c096825b0/comment/5d2f138db17fc0c01b7ea9b2#reply-5d3017ff4187c1d95e103228)

[Carlos Caballero](https://hashnode.com/@carlillo) [Joseph S Stevens](https://hashnode.com/@josephscottstevens) Yeah they're not inviolable Laws of Nature. But some apply more generally than others.

The subset of the Guideline of Demeter that I do adhere more strictly to is to not mutate fields of members of members (or really, it's on the object to not expose things that can mutate their internals).
