Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>How timely. I am going to write a post on my blog tonight about this smell, <a href="http://sis36.berkeley.edu/projects/streek/agile/bad-smells-in-code.html#Message+Chains" rel="nofollow noreferrer">Message Chains</a>, versus its inverse, <a href="http://sis36.berkeley.edu/projects/streek/agile/bad-smells-in-code.html#Middle+Man" rel="nofollow noreferrer">Middle Man</a>.</p> <p>Anyhow, a deeper question is why you have "get" methods on what appears to be a domain object. If you closely follow the contours of the problem, you will either find out that it doesn't make sense to tell a task to get something, or that what you are doing is really a non-business logic concern like preparing for UI display, persistence, object reconstruction, etc. </p> <p>In the latter case, then the "get" methods are ok as long as they're <a href="http://moffdub.wordpress.com/restricted-method-access/" rel="nofollow noreferrer">used by authorized classes</a>. How you enforce that policy is platform -and process-dependent. </p> <p>So in the case where the "get" methods are deemed ok, you still have to face the problem. And unfortunately, I think it depends on the class that is navigating the chain. If it is appropriate for that class to be coupled to the structure (say, a factory), then let it be. Otherwise, you should try to <a href="http://www.refactoring.com/catalog/hideDelegate.html" rel="nofollow noreferrer">Hide Delegate</a>.</p> <p>Edit: <a href="http://moffdub.wordpress.com/2008/10/01/a-hidden-delegation-of-middle-men/" rel="nofollow noreferrer">click here for my post</a>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload