3 ms·
Now how is this an improvement over the Sequel example? I understand the impulse to "Just write SQL." But in practice, with all the string concatenation neede
by jimbokun 12y ago
Now how is this an improvement over the Sequel example?
I understand the impulse to "Just write SQL." But in practice, with all the string concatenation needed to generate actual queries, you can't really see what the SQL will be without running all the code in your head anyway.
- mbreese 12y agoIn practice, I'd reduce this to a query building function in my own code, so the readability would be much better. The benefit is that you don't need to include another library for it to work. Well, that and it is a strategy that works for all languages, not just Ruby.
- scott_s 12y agoAnd the downside is now you need to spend effort maintaing and debugging your custom query builder.
- IanCal 12y agoYeah but a lot of it is quite generic, so could be reused in a few places and therefore make that extra effort worthwhile. In fact, it might be handy in a few places so you could package it up and then have a single place you have to maintain the query building code for several projects. Wait a minute...
- mbreese 12y agoI think you're over estimating the amount of effort that I spend on this.