In my app, Photo has_and_belong_to_many :land_uses I have this helper method in the Photo model: def land_use_list
I\'ve been doing some reading recently and have encountered the Law of Demeter. Now some of what I\'ve r开发者_如何学Pythonead makes perfect sense e.g. the paperboy should never be able to rifle throu
This is a contrived example, say I want to list the population of a country that a person has a friend in, here are two setups below.Would it be best to repeat data in the models?
Is this a violation of the Law of Demeter? private void MoveEmptyCells() { IEnumerable<Cell> cells = thi开发者_运维知识库s.internalGrid.GetAllEmptyCells();
It feels like I\'ve come to a dead end. If I understood it right then if I follow the Law of Demeter I can never make a method that returns an object and then 开发者_如何转开发client code makes calls
Does System.out开发者_如何学Python.println violate the law of demeter? If not, why?Depending on view.
The LOD description I\'ve seen (for example, Wikipedia, C2 Wiki) talk about not calling methods.To quote Wikipedia:
Here\'s开发者_JAVA技巧 a method in my Spring/Hibernate website\'s code that exemplifies my codebase:
According to the Law of Demeter, can you call methods on returned objects? E.g. <?php class O { public function m($http)
I have three classes: Client Session Socket Both Session & Socket depeand on the Client开发者_运维百科 to create both objects.