Is it allowed to call components' components according to the Law of Demeter?
By definition this is not allowed since you should Only talk to your immediate friends.
In other words, the IBrain
service should not expose its internal services through its interface (assuming that GetMemory()
returns an IMemory
service of some kind). Instead, the IBrain
interface should either provide provide a method that allows retrieving the movement -or- the IMemory should be injected directly into
Dog`.