I'm new to all this, too. The kinds of teams I've worked on, generally, 
favor breaking down a problem into separate processes such that we each get 
to work on our own apps which communicate via messaging or http, so I may 
not have quite the experience you have with big "shared-code" libraries 
(other than jar files downloaded from the net).

What I've been moving towards, slowly, is the idea of not caring too much 
about what the actual "thing" is that gets passed around from function to 
function, but instead just caring about the functions themselves and the 
end-result values.

For instance, say you want an S3 client, you might do something like:

(let [client (s3/mk-client)]
  (when (exists? client "bucket-name")
  (post client my-data)
  (println (s3-get client "my-key")))

(Please excuse the poor naming.)

The "client" is actually a map with connection info and other metadata, but 
I just don't have to care as a user of the S3 namespace. All I really need 
to know is what's public in the "s3-client" name space.

Admittedly, this is really a sort-of OO kind of thing (in which I'm doing 
method object params rather than object.method(params)) but it really does 
seem clear when I come back to it later.

I've seen other similar usages, such as the various web frameworks, and 
even the congo-mongo driver. The connection object in congo-mongo is a map 
with some java-driver objects in it, but you don't ever really have to know 
that. Just (with-conn conn (collection :data)) or similar.

The web apps do similar things with the "server" you start up:

(let [server (mk-jetty-server :port 8080 :mode async :foo bar)]
  (jetty server start))

But maybe you're talking about value objects?

I guess the bottom line is that I feel for you question because I've spend 
SO LONG in the OO world that I've lost the sense of "encapsulation" as 
something separate from classes.

K

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to