Comment 1 for bug 947288

Revision history for this message
Duncan McGreggor (oubiwann) wrote :

One way to do this is isolate the functionality in each of the above groups into separate classes (e.g., ImageAPI, ConfigAPI, CacheAPI, AccomplishmentAPI, RemoteAPI, DBUSAPI, etc., maybe with generally useful code going in a parent class, called API).

Then, an overarching class can be created that has aspects (attribute) which are the instantiated API classes. For example:

class SomeGoodName(object):
  def __init__(self, ...):
    self.image = ImageAPI()
    self.config = CongfigAPI()
    self.cache = CacheAPI()
    ...
    etc.

Then, for the AccomplishmentService class to reference, e.g., a RemoteAPI method, it would do something along the lines of:

  self.ad.remote.verifyU1Account(...)

This will keep things more organized, easier to read, easier to maintain (folks will know where to put new functionality and keep things clean, as opposed to rapid crustification), etc.