What is the best way to design a class to see if an update occurs on a property?
I have a whole bunch of classes, and current am going through a re-design of the python package I created. Essentially what I do is take the values of a REST service description, and put them into a class along with the functions that can operate on that service.
I have a bunch of design questions:
- Can I have a bunch of base classes like: Map Service, Feature Service where the functions are defined, but not the properties and create classes on the fly? Is that possible or recommended? Right now I have everything defined for each service type, but I'm trying to see if there is a way to shrink my code base.
- Should I use the get/set properties to track changes and just have a variable called isChanged default set to False and when one property is changed, then change it to True, or is there another way to do this? This relates back to question #1. If I do this by defining each property, then I need a different way to track class changes.
- Since the operations function on web services, should I make them asynchronous and support callback functions? Can anyone provide samples/guidelines on how to properly design a class to support this?
My classes all inherit from object, thus allowing the use of the get/set notation. Example: @property
Thank you for any insight you may provide.
Aucun commentaire:
Enregistrer un commentaire