Hacker News new | past | comments | ask | show | jobs | submit login
Rogue: A Type-Safe Scala DSL for querying MongoDB (foursquare.com)
46 points by abraham on Jan 21, 2011 | hide | past | favorite | 12 comments



Looks nice. It kind of reminds me of LINQ (in spirit)


Why is is that every MongoDB article on HN gets to the font page with 25-odd points but almost no comments? I see them several times a week.


They know they love it, but have almost nothing intelligent to say about it. I'd consider that a virtue as opposed to the alternative.


Getting further along in the process of re-inventing SQL, I see.


Any sufficiently complicated database contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of SQL.

...including every SQL database.


Except for Datalog, Prolog, SPARQL, XQuery, etc. which are non-SQL database query languages.


I'll bite since no one else has asked.

What makes type-safety the most important property of a DSL for querying a database to note when introducing it?


It means that your IDE can add all sorts of auto complete magic and cross-referencing if it knows the types and semantics of the code it is displaying. It can also prevent runtime errors to some extent via static analysis of the query.


I like MongoDB, but am familiar enough with type-obsessed languages like Haskell and Scala to summarize your response as

"not much"

I'd argue there are potentially better priorities available for a DSL->DB mapper. But hey, they're the ones putting themselves out there and putting in the hard work, not me.

So, more power to them and I'm glad they're contributing back to the community.


A common software engineering practice whenever one runs into a bug in production is to say "How can I make sure this class of bugs results in a test failure in the future?"

With a good type system, you can take that thought one step further and say, "How can I make sure this class of bugs results in a compilation failure in the future?"

Rogue lets us do that. The DSL is both expressive (it covers almost all of Mongo's query features) and easy to use (Rogue queries are concise and very similar to Mongo queries), yet they eliminate (at compile time!) a whole class of bugs that have bitten us in the past. When your Rogue query compiles, you can be fairly certain that it will generate a well-formed Mongo query. Getting a similar guarantee from a test suite would involve a lot more work.


Jorge - rogue looks great, and had it existed when I started my current project I might well have picked scala rather than clojure and congomongo (which is great too).

However - when you say it would have involved more work to guarantee well formed queries from a test suite, I find myself wondering how that can be true if you test every function that hits the database. Wouldn't malformed queries would cause such tests to fail?


Ariane 5 Flight 501.

In practical terms, better testing would've saved it, not better type safety.

The rest of the sales pitch doesn't require type safety, although I appreciate that a rather nice piece of software is being shared here.

Type safety obsession reeks of cargo cult to me, but that's not exclusive with well-made software.




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

Search: