Tell, Dont Ask

Tell-Don’t-Ask is a principle that helps people remember that object-orientation is about bundling data with the functions that operate on that data. It reminds us that rather than asking an object for data and acting on that data, we should instead tell an object what to do. This encourages to move behavior into an object to go with the data.

  • Don’t interrogate objects for their internals – move behavior to the object
  • Tell the object what you want it to do

References