Posted by Jim at November 16th, 2004

I’m still screwing around with XML and Java and will likely be doing so for quite some time.

One thing I’m currently meditating upon is whether or not to use recursion in the function that allows me to find particular nodes in my XML document.

On the one hand, all the examples I’ve seen use recursion and I like the elegance of recursion. The simplicity of it appeals to my sense of aesthetics. On the other hand, I’m aware that recursion is often slower than a less appealing iterative design.

Aesthetics or speed? The code will be evaluated by CS profs who probably like recursion themselves. But… if I’m lucky enough to have it evaluated by actual users, the speed might matter–or it might not. These are web pages after all. Not novels. Chances are, the files will be small enough that using recursion won’t slow things down measurably.

I plan to come to a decision sometime soon.