Game Development Reference
In-Depth Information
implicitly. If you think about it, exporting a COM interface from a managed appli-
cation can be thought of as an implicit instance of the adapter pattern so that
unmanaged applications can communicate with managed code. On a higher level,
Windows Forms can also be thought of as an object-oriented adapter between any
CLR-compliant language like C# and the traditional procedural controls available
in the Win32 API. Lastly, you can find some adapters present in the .NET Class
Framework itself. The database connection functionality employs adapters to
interface with a variety of database engines. While each database engine is differ-
ent, the base interfaces for dealing with them remain abstract and consistent.
It is important to note that there is increased performance overhead when using
adapters because all methods called in the adaptee must first be called through the
adapter methods. The best approach, disregarding any time, environment, or bud-
get constraints, is to just refactor the code, but this is rarely the case when devel-
oping tools or games in general.
Part V, “Techniques for Legacy Interoperability,” covers interoperability between
managed and unmanaged code, and specific real-world examples of using adapters
are covered.
The introduction of object-oriented frameworks was a huge step forward in the
area of software component reuse, but recently there has been a push towards the
use of multiple frameworks within a single application. In this chapter, I discussed
the issues behind using multiple frameworks, problems that occur from doing so,
and some possible solutions to overcome these problems. Currently, there are
some solutions to reduce compositional friction, such as the adapter pattern and
employing wrapper objects, but these solutions only partially solve the problem
when they too require a considerable amount of implementation effort. The best
approach for framework reusability is to carefully study the problem domain to
find the appropriate domain coverage, and build your frameworks from the
ground up with a loosely coupled and maintainable architecture.
Search Nedrilad ::

Custom Search