Cross-platform support middleware
A Cross-Platform Support Middleware (CPSM) is a software abstraction layer that guarantees the existence, and correct implementation, of a set of services on top a set of platforms.[1]
Formal Model
Formally, a CPSM can be represented by the following model:
- Let be the set of provided services, and the elements of that set, with .
- Let be the set of supported platforms, and the elements of that set, with .
- The special service denotes the set of trivially cross-platform services provided (e.g. programming language, buffered I/O, etc).
- Thus, a CPSM can be defined as:
Where the strong condition for the existence of is that every service in is available in every platform in .
The formal model may be extended to account for the abstract and concrete (native) interfaces of the services provided:
- Let be the concrete (native) interface for service in platform .
- Let be the set concrete (native) interfaces (i.e. ).
- Let be the abstract interface for service , provided by the CPSM regardless of the underlying platform</math>.
- Let be the set abstract interfaces (i.e. ).
Formally, the strong condition for the existence of a CPSM can be expressed as:
Trivial CPSM
There are two trivial cases of a CPSM: the single-platform CPSM and the inherently compatible CPSM.
A single-platform CPSM is compatible with one, and only one platform. Formally, , or, equivalently, . In broad terms, an operating system might be considered a single-platform CPSM.
An inherently compatible CPSM is an abstraction layer that only provides services trivially compatible in every compatible platform. Formally, , or, equivalently, .
Non-trivial CPSM
A non-trivial CPSM must verify two conditions:
- The compatible platform set must contain at least two platforms.
- The provided services set must contain at least one non-trivial service.
Formally:
Abstraction method
The abstraction method in the CPSM development is the method used to compile the concrete source code for a given platform without compromising the abstract interfaces provided. The most commonly used abstraction methods in CPSM development are: conditional compilation and directory separation of sources.
The first method consists in embedding preprocessor instructions in the source code to conditionally select the source subtree compatible with a given platform.
The second method takes advantage of the filesystem organization to divide the source code in different folders, one for each incompatible platform. Thus delegating the selection problem to the build system.
Some distributions like MSYS and cygwin may help build the cross-platform code in a unix-like environment even on Microsoft Windows. Both distributions provide a decent version of GNU Make that can direct the build process in a cross-platform fashion.
See Also
- Adaptive Communication Environment
- Netscape Portable Runtime
- Simple DirectMedia Layer
- wxWidgets
- Boost C++ Libraries
References
- ^ Zavolinsky, Patricio. "Abstracción en el desarrollo de software independiente de la plataforma: Análisis del proceso de desarrollo de Cross-Platform Support Middlewares (spanish)" (PDF). Universidad de Buenos Aires, Argentina. Retrieved 2008-09-25.