Barbie says: Math is hard

Model-View-Controller SeparationIf there were a programmer action doll, it would utter “MVC is hard” just like Barbie did.

There’s some interesting psychology behind why it is difficult to discipline oneself to separate code into the different concerns of software (not just model-view-controller, but also cross-cutting concerns like persistence and security). One of the best explorations of this topic came in an interview I just read.

Terence Parr (the interviewee) is a bright guy. The interviewer is a pragmatic guy who makes reference to his team’s use of the Velocity project, which I was lucky enough to see a quick demo of this weekend. Velocity is a Java-based template engine; it lets programmers use a template language to reference objects defined in Java code.

StringTemplate is Parr’s creation, and it provides more enforcement of the separation of concerns by driving more function back into the model, where he says it belongs. He states his agreement in principle with Velocity’s creator, Geir Magnussen, but at the same time has been more ruthless in StringTemplate’s approach to simplicity and separation.

I have no idea who has a better approach — I have yet to see StringTemplate in action or actually use either technology directly, but I can completely agree with Parr’s assessment of how programmers slide down the slippery slope of intermixing function that is best kept separate.