Explanation needed, for “Ask, don't tell” approach?

Posted by the_naive on Programmers See other posts from Programmers or by the_naive
Published on 2013-11-09T20:10:12Z Indexed on 2013/11/09 22:08 UTC
Read the original article Hit count: 527

I'm taking a course on design patterns in software engineering and here I'm trying to understand the good and the bad way of design relating to "coupling" and "cohesion".

I could not understand the concept described in the following image. enter image description here The example of code shown in the image is ambiguous to me, so I can't quite clearly get what exactly "Ask, don't tell!" approach mean. Could you please explain?

© Programmers or respective owner

Related posts about design-patterns

Related posts about object-oriented-design