good commercial and open source libraries, it makes much more sense to simply reuse code that
others have written. For example, there are various open source image reading APIs and XML pars-
ing APIs that you can download and use in your application today. These libraries have been refined
and debugged by many developers around the world and have been battle-tested in many other
programs.
In essence, software development has become much more modular, with the use of distinct com-
ponents that form the building blocks of an application and talk together via their published APIs.
The benefit of this approach is that you don’t need to understand every detail of every software com-
ponent, in the same way that for the earlier house building analogy you can delegate many details to
professional contractors. This can translate into faster development cycles, either because you can
reuse existing code or decouple the schedule for various components. It also allows you to concen-
trate on your core business logic instead of having to spend time reinventing the wheel.
One of the difficulties in achieving code reuse, however, is that you often have to come up with
a more general interface than you originally intended. That’s because other clients may have addi-
tional expectations or requirements. Effective code reuse therefore follows from a deep understand-
ing of the clients of your software and designing a system that integrates their collective interests
with your own.
C
++
APIs AND THE WEB
The trend toward applications that depend on third party APIs is particularly popular in the field of cloud
computing. Here, Web applications rely more and more on Web services (APIs) to provide core functionality. In the
case of Web mashups, the application itself is sometimes simply a repackaging of multiple existing services to
provide a new service, such as combining the Google Maps API with a local crimes statistics database to provide a
map based interface to the crime data.
In fact, it’s worth taking a few moments to highlight the importance of C
++
API design in Web development.
A superficial analysis might conclude that server side Web development is confined to scripting languages, such
as PHP, Perl, or Python (the “P” in the popular LAMP acronym), or .NET languages based on Microsoft’s ASP
(Active Server Pages) technology. This may be true for small scale Web development. However, it is noteworthy
that many large scale Web services use a C
++
backend to deliver optimal performance.
In fact, Facebook developed a product called HipHop to convert their PHP code into C
++
to improve the
performance of their social networking site. C
++
API design therefore does have a role to play in scalable Web
service development. Additionally, if you develop your core APIs in C
++
, not only can they form a high performance
Web service, but your code can also be reused to deliver your product in other forms, such as desktop or mobile
phone versions.
As an aside, one potential explanation for this shift in software development strategy is the result
of the forces of globalization (Friedman, 2008; Wolf, 2004). In effect, the convergence of the Inter-
net, standard network protocols, and Web technologies has created a leveling of the software playing
field. This has enabled companies and individuals all over the world to crea te, contribute, and com-
pete with large complex software projects. This form of globalization promotes an environment
where companies and developers anywhere in the world can forge a livelihood out of developing
software subsystems. Other organizations in different parts of the world can then build end-user
applications by assembling and augmenting these building blocks to solve specific problems. In
terms of our focus here, APIs provide the mechanism to enable this globalization and componentiza-
tion of modern software development.
8 CHAPTER 1 Introduction