18.04.2015 Views

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

THE MICROSOFT COMPONENT OBJECT MODEL<br />

ESRI chose COM as the component technology<br />

for <strong>ArcGIS</strong> because it is a mature technology that<br />

offers good performance, many of today’s<br />

development tools support it, and there is a<br />

multitude of third-party components that can be<br />

used to extend the functionality of ArcObjects.<br />

The key to the success of components is that<br />

they implement, in a practical way, many of the<br />

object-oriented principles now commonly<br />

accepted in software engineering. Components<br />

facilitate software reuse because they are selfcontained<br />

building blocks that can easily be<br />

assembled into larger systems.<br />

Before discussing COM specifically, it is worth considering the wider use of software<br />

components in general. There are a number of factors driving the motivation<br />

behind software components, but the principal one is the fact that software development<br />

is a costly and time-consuming venture.<br />

In an ideal world, it would be possible to write a piece of code once and reuse it<br />

again and again using a variety of development tools, even in circumstances that<br />

the original developer did not foresee. Ideally, changes to the code’s functionality<br />

made by the original developer could be deployed without requiring existing users<br />

to change or recompile their code.<br />

Early attempts at producing reusable chunks of code revolved around the creation<br />

of class libraries, usually developed in C++. These early attempts suffered from<br />

several limitations, notably difficulty of sharing parts of the system (it is difficult to<br />

share binary C++ components—most attempts have only shared source code),<br />

problems of persistence and updating C++ components without recompiling, lack<br />

of good modeling languages and tools, and proprietary interfaces and customization<br />

tools.<br />

To counteract these and other problems, many software engineers have adopted<br />

component-based approaches to system development. A software component is a<br />

binary unit of reusable code.<br />

Several different but overlapping standards have emerged for developing and<br />

sharing components. For building interactive desktop applications, Microsoft’s<br />

COM is the de facto standard. On the Internet, JavaBeans is viable technology. At<br />

a coarser grain appropriate for application-level interoperability, the Object<br />

Management Group (OMG) has specified the common object request broker<br />

architecture (CORBA).<br />

To understand COM—and, therefore, all COM-based technologies—it’s important<br />

to realize that it isn’t an object-oriented language but a protocol, or standard.<br />

COM is more than just a technology; it is a methodology of software development.<br />

COM defines a protocol that connects one software component, or module,<br />

with another. By making use of this protocol, it’s possible to build reusable<br />

software components that can be dynamically interchanged in a distributed<br />

system.<br />

COM also defines a programming model known as interface-based programming.<br />

Objects encapsulate the manipulation methods and the data that characterizes each<br />

instantiated object behind a well-defined interface. This promotes structured and<br />

safe system development since the client of an object is protected from knowing any<br />

details of how a particular method is implemented. COM doesn’t specify how an<br />

application should be structured. As an application programmer working with<br />

COM, language, structure, and implementation details are left up to you.<br />

COM does specify an object model and programming requirements that enable<br />

COM objects to interact with other COM objects. These objects can be within a<br />

single process, in other processes, or even on remote machines. They can be<br />

written in other languages and may have been developed in different ways. That<br />

is why COM is referred to as a binary specification or standard—it is a standard<br />

that applies after a program has been translated to binary machine code.<br />

58 • <strong>ArcGIS</strong> <strong>Engine</strong> <strong>Developer</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!