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

Sigh. Whenever I have to hurt myself at work on such issues, I find myself thinking of the web that could have been, if only...

Let me backtrack a bit. There's a much better way to do things than the way we do it right now. A way that completely obviates the need for ORMs, or indeed any way to deal with the interface between application and database.

You see, there would be no object-relational Impedance Mismatch (and therefore no need for such clunky kludges like ORMs) if the database and the application were both written in languages of the same paradigm, either both OOP or both relational. Ideally, that would be a single language, that could handle both data and application logic.

There is such a language: Prolog [1]. Prolog is implemented as a relational database. So your program itself is the database. There is no separation between data and operation and therefore no ORIM and no need for ORMs, or stored procedures or anything, really.

And, yes, it's perfectly possible to do your web dev in Prolog. Here, see this explainer on the Swi-Prolog website, titled "Can I replace a LAMP stack with SWI-Prolog?":

http://www.swi-prolog.org/FAQ/PrologLAMP.txt

Hint: Yes. Yes, you can. You can replace LAMP (or LAM-whatever) with an LP stack, where all you need on top of your OS is Prolog itself. Its built-in Definite Clause Grammars notation [2] can be used to parse and generate javascript, html, xml, css, YAML, whatever you like. Swi-Prolog even offers translation to RDF, which is as natural as you can expect given RDF is also a relational language.

Here's a big fat tutorial to help you started:

www.pathwayslms.com/swipltuts/html/index.html

Can this be done for real? OMG yes it can. The Swi-Prolog website itself runs on an LP stack. There's a few more websites that do too:

www.pathwayslms.com/swipltuts/html/index.html

In short: you don't need to hurt yourself as badly as you 're currently doing it. There's no other need than of course, nobody wants to learn Prolog. I know that, I've made my peace with that and I've spent all of my so-far career hurting myself against the ORIM just like everyone else.

... but we could have had a better web.

___________________

[1] https://en.wikipedia.org/wiki/Prolog

[2] https://en.wikipedia.org/wiki/Definite_clause_grammar



This sounds really interesting, but I'm having a lot of trouble trying to follow how all that code fits together - from what code I could find. I also strongly dislike the object/function based approach to constructing HTML (which - funnily enough, is just like using an ORM to construct SQL which I like heh).

Really, I don't see enough offered to counteract what little pain I feel using an ORM. The LP actually looks more painful (to me). Obviously I'm totally unfamiliar with this stack which makes it hard for me to see where the benefits lie.


>> Really, I don't see enough offered to counteract what little pain I feel using an ORM.

In that case you'd probably find no benefit in giving up the use of one, regardless of what replaced it.




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

Search: