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

Absolutely. One of the things I like about Groovy is that it solves the other half of that equation because it has the built in map constructor and built in SQL APIs that work with it. So you can actually do

    class Foo {
        Long id
        String name
        ...
    }

    Foo foo = new Foo(db.firstRow("select * from foo limit 1"))
And it all just works if the database columns match the fields of Foo. And if you just do

    Foo foo = new Foo(db.firstRow("select name from foo limit 1"))
Then you get a `foo` with only the name populated, etc, and you got type safety, easy direct, efficient SQL queries and the ability to test your code without hitting the database, all without imposing any "leaky" abstractions that cause all the problems.


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

Search: