On Thu, 2004-09-30 at 13:51 -0400, Brett Viren wrote:
> I want it to trigger an XML-RPC call to set the "something" parameter
> on the server.  I've implemented MyModel.__setattr__() to do this
> interception and from there pass the call along to the parent by
> calling Model.__setattr__().
> 
> This seems to work, but is it the best way?  For example, in the end
> my __setattr__ will have a big list of if blocks, one for each
> intercepted property which isn't so pretty.
It is not obvious to decide here. You might think to keep your solution,
maximizing locality of the handling code, that is not necessarily a bad
idea. From one hand, the code might become bigger and bigger, but the
locality of the comunication with the server might improve code
inspection, bug fixing, commitment of new code, etc.  

>From the other hand, there is the necessity of catching modification on
the server's data. How the view/controller pair would be notified of
this modification? What happens whether other data that depend on the
changed one must be updated? 

In my opinion everytime you have mutual dependencies between data,
bidirectional data flows, and need for separation of model and data
representation, you might think to consider the use of mvc and observer
patterns. 

I am not sure gtkmvc would capture all requirements in your case, since
it "forces" you to put notification about observable properties in
separate class methods. 

Actually, if you were able to adapt the metaclass that generates the
code that implements the observer pattern, you might think to make the
model comunicate with the server via RPC for free, since the
comunication code would be generated as well. This would be possible
only if the function that maps model's data to server's data were
injective. Under the necessary condition, it is a matter of deriving a
new metaclass from the one that gtkmvc.model.Model currently uses. 

Feel free to ask for further details, maybe out of this list since I
think this is going OT. 
rob

-- 
  _/_/_/   _/_/_/   Roberto Cavada
 _/   _/ _/        ITC-irst   http://www.irst.itc.it
_/   _/ _/        Automated Reasoning Systems - Formal Methods Group
/_/_/  _/        Via Sommarive, 18 - 38050 Povo (TN) - Italy
   _/  _/       Tel: +39 0461 314 328   Fax: +39 0461 302 040
    _/   _/_/  [EMAIL PROTECTED]   http://sra.itc.it/people/cavada

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to