Most Popular Interface

Pattern Name and Classification: Most Popular Interface (Behavioral)

Intent: To provide a rounded and robust common interface for two or more software components that are non-identical but which share some common methods.

Also Known As: N/A

Motivation: When integrating existing software components into a Service-Oriented Architecture (SOA) it is necessary to create a Service Interface that captures the functionality of that software and makes it available as a Service. Similar software components should be wrapped with a common interface to enable them to be used modularly within the SOA. The Most Popular interface is an approach that produces a compromise interface that reflects the best practice of many legacy systems.

Implementation: A Most Popular interface is an interface whose methods form a set M, such that the intersection of the methods of two or more legacy systems is a proper subset of M. The methods included in M are chosen by a group of experts, to reflect the functionality that they believe would be expected by the community.

Structure: Figure shows a Venn diagram comparing the hypothetical interfaces of two legacy systems (A,B) with the Most Popular interface, a subset C, such that the intersection of A and B is a proper subset of C.



Applicability: It is feasible to use a Most Popular interface when there is agreement between experts in a community about the core functionality that should be expected from that type of system.

Participants: The pattern applies to at least two software components which have service-like behavior that is similar. It can be generalised to include more components.

Collaboration: The Most Popular interface can be implemented as an Adaptor-style service. In some cases there will be a mismatch between the functionality represented in the interface and that supported by the wrapped legacy system. There are two possible approaches, to either make the mismatched methods empty calls, that return null, or to replicate the missing functionality with new code (that may utilize the functionality of the wrapped legacy system in a new way).

Consequences: The Most Popular interface is complex to derive, and may require a prolonged standardization effort, but it is highly effective at capturing a broad set of capabilities from legacy software and creating a robust and reusable common service. If experts differ then it is possible that many competing common interfaces evolve. It is also possible that in some cases no common view exists. When implementing missing functionality there are two approaches that may be taken: The wrapping service might use additional information that was not part of the wrapped legacy system. In this case the new information must be created in order for the wrapping service to work. For example, some item bank services have a Search by Keyword method, for those item banks without this method keywords for each item must be created and stored, so the method can be simulated.The wrapping service uses existing information within the legacy system in a new way in order to simulate the method. In the Search by Keyword example a Term Frequency analysis could be used on the main text of the items, held in the legacy system, to calculate keywords at runtime.

The latter approach is more robust, and can deal with changing data within the legacy system, but may not be appropriate if Quality of Service is an issue.

Known Uses: This pattern was used within the JISC FREMA project to wrap two item banks (TOIA and E3AN). The code is available from the FREMA website (www.frema.ecs.soton.ac.uk).

Related Patterns: Adaptor Pattern described how classes can be wrapped in Object Orientation, it is a structural pattern focusing on methods of implementation, rather than what parts of the wrapped class should be exposed. Lowest Common Denominator Interface and Negotiated Interface are alternative patterns that deal with defining common interfaces for similar software systems.