XSLT and Programming Rules

Jon Udell's latest column for Infoworld talks about rules engines. I've long thought that we underuse rules in solving programming problems. Later in the article, Jon makes the connection to XSLT. I was mentioning this very thing to my CS330 class just this week: XSLT is probably the first declarative programming language to go mainstream. Prolog and others were fun, but never caught on in the commercial environment. XSLT is a different matter.

Programming in XSLT is so different from traditional programming, that many people don't even think of it as programming. They know its similar, but can't quite get their minds around the idea of a programming language with implicit sequencing. In most popular programming language sequencing is explicit: you put in control statements to change the control flow and in their absence statement execution happens in order. In a declarative programming language, the sequencing is implicit and the order of rules in the program text is (usually) immaterial.

This makes XSLT a challenge for most of us. Switching programming paradigms isn't an easy task. I watch students struggle to fall out of their imperative programming habits and start thinking of problems functionally. One of the things you have to do is learn new patterns. Even more important, and more difficult because it can't learned from a book is creating a new mental model of evaluation. We all develop evaluation models in our heads for any programming language we learn and use these models when we program. As a result, becoming proficient in XSLT will only come about with substantial practice for most of us.

Please leave comments using the Hypothes.is sidebar.

Last modified: Thu Oct 10 12:47:20 2019.