tags:

views:

87

answers:

2

In what cases,or for what kind of algorithms, do you start using your objects as data structure with methodes outside of the objects (ie : Tree Walking, etc...).

What scheme do you use ? (Visitor ? pattern-matching ?)

Or do you think an object should always be the only one allowed to act on its own data ?

A: 

Or do you think an object should always be the only one allowed to act on its own data?

That is my philosophy (except for objects that are only entities; ie: they map something else, like an xml file or something and only contain properties)

Juan Manuel
+1  A: 

Objects should have a single responsibility. If the operation you're doing is acting on an object but has nothing to do with the responsibility of that object. It's better to put it outside that object.

Mendelt