<?xml version="1.0" encoding="UTF-8"?>
<essay xml:lang="en" version="5.0" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:gal="http://norman.walsh.name/rdf/gallery#" xmlns:foaf="http://xmlns.com/foaf/0.1/">
<info>
    
    
    
    
    
    
    
    
    
    
    
<title>Implementing XProc, VII</title><biblioid class="uri">http://norman.walsh.name/2007/07/20/implXProcVII</biblioid>
<volumenum>10</volumenum>
<issuenum>70</issuenum>
<pubdate>2007-07-20T07:34:07-04:00</pubdate>
<date>$Date$</date>
<author>
      <personname>
<firstname>Norman</firstname>
	<surname>Walsh</surname>
</personname>
    </author>
<copyright>
      <year>2007</year>
      <holder>Norman Walsh</holder>
    </copyright>
<abstract>
<para>Part the seventh, in which we (re)consider a fundamental part of the
design.</para>
</abstract>
<dc:subject rdf:resource="http://norman.walsh.name/knows/taxonomy#Java"/>
<dc:subject rdf:resource="http://norman.walsh.name/knows/taxonomy#XProc"/>
</info>

<epigraph>
<attribution>
      <personname>
<firstname>Frederick P.</firstname>
	<surname>Brooks</surname>
<lineage>Jr.</lineage>
</personname>
    </attribution>
<para xml:id="p3">Plan to throw one away. You will anyway.</para>
</epigraph>

<para xml:id="p1">This essay is part of a series of essays about implementing an
<wikipedia page="XML_pipeline">XProc</wikipedia> processor.
<citetitle xlink:href="http://www.w3.org/TR/xproc/">XProc: An XML Pipeline
Language</citetitle> is a W3C specification for specifying a sequence of operations
to be performed on one or more XML documents. I'm
<link xlink:href="http://xproc.dev.java.net/">implementing XProc</link> as
the specification progresses. Elsewhere you'll find background
<link xlink:href="http://norman.walsh.name/2004/06/20/pipelines">about
pipelines</link> and other essays
<link xlink:href="http://norman.walsh.name/knows/what/xproc">about XProc</link>.</para>

<para xml:id="p2">I implemented XProc in the traditional way: I threw the first
one out. In fact, I threw the first two out. And I think the third is headed
for a major refactoring.</para>

<para xml:id="p4">Given a pipeline, my implementation does two things: first, it
<link xlink:href="/2007/05/02/implXProcII">builds and augments</link>
a model of the pipeline. This step makes defaults explicit, checks the
validity of the pipeline, and makes a few changes that are necessary
for my implementation to process it. In this model, the objects all
represent “source artifacts” of one form or another.</para>

<para xml:id="p5">Next, it constructs <emphasis>another model</emphasis> of the
pipeline designed for execution. In this model, the objects all represent
“steps” of one form or another.</para>

<para xml:id="p6">On the surface, this seems like a good idea. Validation and
execution are different processes.
<wikipedia page="Separation_of_concerns">Separation of concerns</wikipedia>,
don't you see?</para>

<para xml:id="p7">Except, in practice, they aren't very separate. The execution
model relies on “peeking” into the validation model to get namespace
declarations, to find the names of steps, to get to the declarations
for atomic steps, etc. So either I've modelled things badly or
implemented the models badly, or both.</para>

<para xml:id="p8">One of the things that motivated having two models was
that I was anticipating the possibility of accepting multiple
pipeline document syntaxes. I thought modeling the pipeline in a
syntax-agnostic manner before attempting to evaluate it would make
things easier.</para>

<para xml:id="p9">My design vision for the XProc language was a very explicit,
verbose one. Over time, the working group has found consensus in a
much less explicit and verbose design with a fair number of defaults
and syntactic shortcuts. There's much less impetus now to develop a
“compact syntax” version of XProc. I doubt I'll ever bother.</para>

<para xml:id="p10">I think I have two choices: either accept that there's only one
model and refactor the code accordingly, or really make the two models
separate; make sure that all of the information needed in the second
model is passed explicitly to the constructors, for example, instead
of passing just a reference to the object in the first model.</para>

<para xml:id="p11">I'm leaning towards a single model at the moment, but I'm open
to suggestions.</para>

</essay>

