[Tutor] Need a solution.

spir denis.spir at free.fr
Sat Jun 13 12:09:14 CEST 2009


Le Sat, 13 Jun 2009 09:20:36 +0100,
"Alan Gauld" <alan.gauld at btinternet.com> s'exprima ainsi:

> Any time you have a class that just has an __init__ it means 
> its not doing anything. And that's a bad sign. Classes are there 
> to *do* things not just store data. We can use a tuple or 
> dictionary to do that.

While this is probably true for _single_ objects in most case, I guess it really makes sense to create a common structure for object collections. Eg Position, with x & y attributes, for a very simple case. But indeed there are complex ones, possibly with nested structures such as eg Point inlcluding position, color,...
In addition, doing this helps readibility by clearly exposing the object (type) structure in a single & visible place.

All of this applies both to "value" objects (pure information, such as a position) and "real" objects (distinct things, such as a point).
What do you think?

Denis
------
la vita e estrany


More information about the Tutor mailing list