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.

DEVELOPING WITH ARCOBJECTS<br />

<strong>ArcGIS</strong> applications are built using ArcObjects and can be developed via several<br />

APIs. These include COM (VB, VC++, MainWin), .NET (VB.NET and C#),<br />

Java, and C++. Some APIs are more suitable than others for developing certain<br />

applications. This is briefly discussed later, but you should also read the appropriate<br />

developer guide for the product you are working with for more information<br />

and recommendations on which API to use.<br />

The subsequent sections of this chapter cover some general guidelines and considerations<br />

when developing with ArcObjects regardless of the API. Some of the<br />

more common API languages each have a section describing the development<br />

environment, programming techniques, resources, and other issues you must<br />

consider when developing with ArcObjects.<br />

For simplicity, some samples will not follow the<br />

coding standards. For example, it is recommended<br />

that when coding in Visual Basic, all<br />

types defined within an ESRI object library are<br />

prefixed with the library name, for example,<br />

esriGeometry.IPolyline. This is only done in<br />

samples in which a name clash will occur.<br />

Omitting this text makes the code easier to<br />

understand for developers new to ArcObjects.<br />

CODING STANDARDS<br />

Each of the language-specific sections begins with a section on coding standards<br />

for that language. These standards are used internally at ESRI and are followed by<br />

the samples that ship with the software.<br />

To understand why standards and guidelines are important, consider that in any<br />

large software development project, there are many backgrounds represented by<br />

the team members. Each programmer has personal opinions concerning how code<br />

should look and be built. If each programmer engineers code differently, it becomes<br />

increasingly difficult to share work and ideas. On a successful team, the<br />

developers adapt their coding styles to the tone set by the group. Often, this<br />

means adapting one’s code to match the style of existing code in the system.<br />

Initially, this may seem burdensome, but adopting a uniform programming style<br />

and set of techniques invariably increases software quality. When all the code in a<br />

project conforms to a standard set of styles and conventions, less time is wasted<br />

learning the particular syntactic quirks of individual programmers, and more time<br />

can be spent reviewing, debugging, and extending the code. Even at a social level,<br />

uniform style encourages team-oriented, rather than individualist, outlooks—<br />

leading to greater team unity, productivity, and ultimately, better software.<br />

GENERAL CODING TIPS AND RESOURCES<br />

This section on general coding tips will benefit all developers working with<br />

ArcObjects no matter what language they are using. Code examples are shown in<br />

VBA, however.<br />

Class diagrams<br />

Getting help with the object model is fundamental to successfully working with<br />

ArcObjects. Appendix A, ‘Reading the object model diagrams’, provides a<br />

detailed introduction to the class diagrams and shows many of the common<br />

routes through objects. The class diagrams are most useful if viewed in the early<br />

learning process in printed form. This allows developers to appreciate the overall<br />

structure of the object model implemented by ArcObjects. When you are comfortable<br />

with the overall structure, the PDF files included with the software<br />

distribution can be more effective to work with. The PDF files are searchable;<br />

you can use the Search dialog box in Acrobat Reader to find classes and interfaces<br />

quickly.<br />

70 • <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!