> Specifically, I prefer to define the important components of my
> software as Java interfaces. Partly to see myself think, partly
> because it just makes more sense to me. I then want to implement these
> interfaces using gen-class and clojure functions and pass resulting
> objects as function arguments.
>
> My question is: does this combination of Java interfaces and gen-class
> impact clojure-ness in any way? In other words, would I be living in a
> different world if I would just implement my functions and pass those
> functions around as function arguments without using Java interfaces
> and gen-class?

It sounds like you're thinking of an object-oriented design. Clojure
is not particularly object-oriented.

Interfaces are good, but defining your own is mainly reserved for Java
interop. You should strive to use plain old untyped data structures
for your data, ie. just put things in maps, vectors, sets andl lists.
Write (pure) functions to transform the data, and some logic to handle
program state. Try to keep a clear separation between state-handling
or "interactive" code and data-handling logic. Also make use of
Clojure's sequence abstraction. The core libraries have many functions
for processing sequences.

The core abstraction in Clojure is a function. There is a feature
called "protocols" in git master that will become the Clojure way of
defining interfaces, but even if it is a protocol, the interface is
simply a collection of functions. If you're used to object oriented
programming, you need to invert your thought process from "What
methods does this object have?" to "What data can this function
process?"

-- 
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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to