On Sun, 2008-10-26 at 21:18 +0100, Dirk Meyer wrote:
> Yes. I don't know why I did not check the code better when doing the
> change. Thanks.

I might have spoken up a bit sooner (I haven't been reviewing cvslog
very closely this week as I've been quite busy), but I think we need to
be a little bit careful with the property stuff.  Specifically, when
setting (or god forbid, getting) a property has significant
side-effects, I think that should raise some red flags to force us to at
least ask the question as to why a method isn't more suitable.

The monitor property is a good example.  The first red flag for me was
the naming: you changed a method (action) called monitoring (noun) to a
property (noun) called monitor (action, at least in this context).

The getter for monitor is simple enough, but the setter involves some
fairly non-trivial logic -- that is to say, it has some significant
side-effects.

Of course the whole point of properties is that we want to wrap some
logic around the getter or setter, and setter properties will of course
have side-effects.  But intuitively, I think when those side effects are
complex, a method should be considered, and you should have some
rationale for using a property in that case.

It's probably a tricky balance, and I admit I don't yet have a complete
grasp on the best practices.  There doesn't seem to be a lot of
established conventional wisdom on the topic either, at least in the
Python world.

Did you consider having a monitor(bool) method, and a readonly
monitoring property that returns the current monitoring state?

Jason.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to