Do YOU regard THIS as a good programming-style?

Do all of your objects have results that are recieved via
checking the 'obj.row_length' member? Are all of your objects properly
described via "do_action()"? Do any of them have returns?

Note that I'm asking these questions based on experience. Giving
objects with different internal and external functionality the same set
of "do everything" method can get you confused about what they do. The
only time that the external methods should be similar is if the objects
themselves do a similar set of things.

Take, for example, all of the wxWidgets/wxPython widgets which have
SetValue() and GetValue() methods. Or even the set of widgets with
SetStringSelection() and GetStringSelection() methods. Or GetLabel()
and SetLabel()... Each of those objects have a particular set of things
that they could be used for. If you have class foo and bar, they share
the do_action() method and nothing else, and you have them in various
places, how are you, or anyone else, supposed to realize that
foo.do_action() and bar.do_action() can do very different things?

There is one other thing that will get you nailed for style, your method
name 'sort_row_by_profit_or_loss' is way too long, and 'tell_row_length'
is pushing it.

- Josiah

···

Franz <franzlinux@gmx.de> wrote:

Josiah Carlson schrieb:
> Your method is named poorly. "do action" as a phrase is very ambiguous.
> What action? "kill computer"? "run two methods get the result from
> obj.row_length"?

I actually have every object implemented with this function. I did it
because it always contains all functions in the right order to get a
result. So I only need to call this method and voilá, got the output for
my input.