of abstraction so that by the time you reach the end of the document, you are in
fact dealing with objects at an abstract level.
One side effect of such declarative programming arises over the issue of
time. Traditional procedural programming by its nature correlates the position
of the code in a routine with time; in other words, any coding written following
a particular line of code will be executed after that code (within the same rou-
tine, of course).
The declarative nature of SVG is much less temporal in natureto the extent
that you could easily invert the structure of an SVG document so the definitions
for objects occur after the objects themselves are invoked, with no real effect on
the way the world is rendered. Because of this, in the SVG model, time becomes
just one more parameter to work with (usually as part of the various SMIL ani-
mation elements). Consequently, creating multimedia applications using SVG is
surprisingly easy, especially once you understand that in multimedia program-
ming, the graphics, sound, and video are easy. Unfortunately, its time
management that generally proves to be the nightmare.
Coding against the DOM breaks this model somewhat because you reintro-
duce time into the equation. Currently, that is unavoidable; the language is still
evolving dramatically, and most practitioners of SVG would rather have some-
thing that requires patches now than an idealized version of the language that
would never actually appear. As more the growing number of SVG developers
raise more issues, youll likely begin seeing less of a need to jump into procedural
code to extend the functionality of the language.
As you begin to play with SVG, you should keep this idea in your head: The
best SVG code is the one that least breaks the declarative nature of the language.
When I started working with SVG, I had a tendency to assume that the language
was too simplistic for what I wanted to do, only to discover after having coded
some hairy procedure in JavaScript that a little more digging would have revealed
an already existing capability that did pretty much everything I had needed. Ive
rewritten a lot of the code in this book as Ive become more adept with the lan-
guage, and Im astonished and amused to find that my final SVG code is much
less procedural than when I started out. I hope as you get a chance to play with
this technology that you will discover this same realization. Its a powerful one,
Zen-like in its profundity, and it provides a good indication why I think declara-
tive language programming will become the predominant way to program.
Installing the Adobe SVG Viewer
Adobe has been one of the major backers of the SVG standard since its inception,
and if it succeeds, it will almost certainly be directly because of the efforts of
Adobe. One of the key pieces of Adobes strategy with regard to SVG is the Adobe
SVG Viewer.
17
Why SVG?