Comment left for

Embracing Languages Inside Languages

The “sql is different across platforms” argument is pure nonsense. If you stick to the ANSI syntax it will work across MySQL/Oracle/DB2 and most of the others.

If you use something like Oracle avoid decode() and the (+) operator for outer joins – the standard syntax will work.

Stick to the standards and you’ll be fine.

I code in Ruby on Rails these days and use ActiveRecord for most of my database needs. Interestingly, the design goal for this was to make the simple stuff really easy (finding things, getting sets of child records etc.). But you can still put raw SQL in for more complex tasks that can’t be expressed in Object crud. This works really well.

Ruby’s metaprogramming makes it really easy to implement ActiveRecord, it has a method_missing method that allows it to intercept things like

Person.find_by_first_and_last_name “fred”, “smith”

and turn it into SQL (and also add this method into the class on the way so there is’t any runtime penalty after the first invocation). You can write really fluent-looking code that reads well, and also dive into SQL for grouping and so on (or proprietary hacks) if you must.

I can’t go back to Java and have never had to work with its child C#. I can just write code that reads like English. If I were going back I’d use Hibernate though – again it does the 95% really well and you don’t have to care about your database engine.

Regular expressions are part of the Ruby language and are first-class members of the object hierarchy. Working with them is really easy and they have the standard syntax. Again … Java … C# … shudder.