unpythonic use of property()?

Luis Zarrabeitia kyrie at uh.cu
Wed Apr 22 13:13:46 EDT 2009


On Monday 20 April 2009 11:29:19 am J Kenneth King wrote:
> Changing the ID value would break things on the server, so I
> wanted to write the interface class to respect those conventions.

Then, take this opportunity fix the server and prevent it from breaking once 
you change the ID, because:

> I'm well aware that if a developer really wanted to, they could get
> around it no matter what I did, but I figure that if I at least make
> it really difficult it will be obvious that they're really going into
> dangerous territory.

you will have to do it anyway.

I think it's great, for you, that the language you are using makes it so 
extremely easy to bypass almost any access restriction that you may put in 
the data sent to your clients. That means that you won't be overconfident, 
that you are forced to make sound decisions from the beginning, and that you 
won't be trusting that your clients will be well behaved (even with very 
strong enforcement of data hiding, a malicious client could forge the 
connection).

Then, when the server is safe from user data, by all means go and make sure 
that the clients (and even the server!) will complain as loudly as possible 
if they want to break encapsulation.

-- 
Luis Zarrabeitia (aka Kyrie)
Fac. de Matemática y Computación, UH.
http://profesores.matcom.uh.cu/~kyrie



More information about the Python-list mailing list