Note that there are some explanatory texts on larger screens.

plurals
  1. POhow does one _model_ data from relational databases in clojure?
    text
    copied!<p>I have asked this question on twitter as well the #clojure IRC channel, yet got no responses.</p> <p>There have been several articles about Clojure-for-Ruby-programmers, Clojure-for-lisp-programmers.. but what is the missing part is <strong>Clojure for ActiveRecord programmers</strong> .</p> <p>There have been articles about interacting with MongoDB, Redis, etc. - but these are key value stores at the end of the day. However, coming from a Rails background, we are used to thinking about databases in terms of inheritance - has_many, polymorphic, belongs_to, etc. </p> <p>The few articles about Clojure/Compojure + MySQL (<a href="http://briancarper.net/blog/clojure-and-compojure-to-the-rescue-again" rel="noreferrer">ffclassic</a>) - delve right into sql. Of course, it might be that an ORM induces <em>impedence mismatch</em>, but the fact remains that after thinking like ActiveRecord, it is very difficult to think any other way.</p> <p>I believe that relational DBs, lend themselves very well to the object-oriented paradigm because of them being , essentially, Sets. Stuff like activerecord is very well suited for modelling this data. For e.g. a blog - simply put </p> <pre><code>class Post &lt; ActiveRecord::Base has_many :comments end class Comment &lt; ActiveRecord::Base belongs_to :post end </code></pre> <p>How does one model this in Clojure - which is so strictly anti-OO ? Perhaps the question would have been better if it referred to all functional programming languages, but I am more interested from a Clojure standpoint (and Clojure examples)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload