My project has an IAccommodation object type, representing a generic
housing unit, from which we subclass several types of housing
(ISharedHouse, IFamilyHouse, ILargerDevelopment,...).

Now, we need to recognise various "standards" in relation to these
accommodation units -  these are standards that have been defined by
various local councils etc, and an accommodation unit typically has to
meet certain conditions before it can be deemed to meet that standard.
A property that meets a standard is deemed to be better than one that

However, there is a degree of complexity to these standards...

* Different standards will apply to different accommodation types.
* Some accommodation types will have no relevant standard.
* Some standards will apply to an accommodation type in some
geographic areas but not other areas.

One reason we want to handle these standards is to be able to rate the
accommodation. E.g., a house that wasn't part of the "Accreditation
Scheme" standard could appear lower in search results than one that
was. Naturally, where there is no relevant standard for an
accommodation to live up to, we do not want to penalise it in this way
(or possibly would want it to appear below those that do meet a
standard, and those that don't meet a standard but could...)

Now, I believe I should be defining an interface or interfaces for
standards and using adapters to adapt my Accommodation Objects to the
'standards' interface(s).

My question is, how best to handle the complexity I've outlined above?

One thought I had, was creating an interface IStandard, with
attributes like "meetsstandard" and "nameofstandard", and then
subclass this, e.g. to IAccreditationScheme and INationalCode (where
"Accreditation Scheme" and "National Code" are the names of two of the
standards). But I get a little stuck conceptually at the point where I
try to handle, for example, the fact that for some ISharedHouse
objects, IAccreditationScheme would be suitable, whilst for others it
wouldn't, because of their location. In fact it's likely that in the
future we will need to recognise two or more standards for a
particular accommodation type (so IAccreditationScheme and IHouseCheck
chould both apply to ISharedHouse objects, in differect areas).

I recalled reading in Philipp's book about "Named Adapters", but
looking back I can only find brief references to them. A 'search'
through the PDF of Stephan's book reveals no instances of the phrase
"named adapter" (or variations). Are these something I should be
looking into, and if so, where can I read up on them?

Or does anyone have any other suggestions on handling this?

Many thanks,
Zope3-users mailing list

Reply via email to