Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

  > then one day you realise you're looking at unintelligible nonsense and you say "Oh no, what have we done?"
I think that’s a bit of what the Java String Template folks went through.

It was a pretty cool system (on the surface, not having used it, I liked what I saw), but they pulled it straight out. They felt the direction was unworkable. Pretty interesting considering I think the demand for such a facility (as mentioned, once tasted, hard to let cider), plus the work involved to date. Interesting they found it irredeemable to shelve it entirely and back to the white board.



I tend to stuff complicated strings (SQL queries and such) into resources (files that get baked into the JAR) and implement some kind of templating for them if I think it's necessary.


With proper escape (un-taint) on any user input, right?


Of course. If it is SQL you ride on JDBC already supporting placeholders, so there isn't any need for you to support substitutions for ordinary SQL.

If you want to do more complex "Dynamic SQL", say you are writing a query builder where people can fill out fields to do a complex query, your best bet is JooQ, which I use heavily at work.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: