Hi Folks,
I'll be starting a new project soon. The current system is a Java-based web
application, and I'd like to move it toward a less imperative, more
declarative architecture.
On paper, this seems straightforward: use technologies like XSLT, XPath, and
XQuery to express transformations declaratively.
But I'm running into a practical problem.
If I show Java developers their code alongside equivalent XSLT, I already know
what the reaction will be:
1. "This is just another programming language."
2. "It has iteration, functions, recursion--how is this fundamentally
different from what we already have?"
3. "Why should I replace code I understand with code I don't?"
At that point, the argument that "XSLT is declarative" doesn't land. It feels
like a theoretical distinction rather than a practical one.
Which leads me to a more uncomfortable question:
If a language is declarative, but most developers do not experience it as
declarative, does that distinction actually matter?
In other words, is "declarative" a property of the language--or of how the
language is perceived and used?
Because in practice:
1. XSLT is often written in a way that looks and feels procedural.
2. Developers map it mentally onto loops, conditionals, and function
calls.
3. The promised shift in thinking ("what" rather than "how") never really
happens.
And if that's the case, then a proposal like:
"Let's replace a Java implementation with XSLT because it's declarative."
is unlikely to succeed--not because XSLT is weak, but because the benefit is
not obvious to the people being asked to adopt it.
So I'm trying to understand:
1. How do you make the declarative nature of XSLT visibly obvious to
someone who doesn't already believe it?
2. Are there patterns, examples, or constraints that make XSLT clearly
different from imperative code?
3. Or is the harder truth that some declarative technologies--such as
schemas (e.g., XML Schema), data models, and rule-based systems (e.g.,
Schematron)--communicate their declarative nature more directly than others?
I'm not questioning the theoretical classification of XSLT.
I am questioning whether that classification is sufficient to drive adoption
in real-world systems.
Curious to hear how others have dealt with this.
Best,
Roger
|