A hopefully short and concise explanation as to how Clojure deals with Objects. If you already write Clojure, this isn't for you.
You know what an Interface is if you write/read Java or PHP 5+. In Clojure it might be called defprotocol.
user> (defprotocol IABC
(also-oo [this])
(another-fn [this x]))
IABC
You might be tempted to use the classic implements or extends keywords when defining a new Class. In Clojure it might be called defrecord.
user> (defrecord ABC [name]
;; You can implement multiple Classes here
IABC
(also-oo [this]
(str "This => " (:name this)))
(another-fn [this x]
(format "%s says: %s" (:name this) x)))
user.ABC
You might be tempted to use the classic new keyword to instantiate a new object. In Clojure it might be a simple decimal suffix added to the Class name so that it can be used as a predicate.
user> (def a (ABC. "Roger"))
#'user/a
user> (another-fn a "oo programing")
"Roger says: oo programing"
user> (also-oo a)
"This => Roger"
Clojure can just do it better.
user> (defmulti this-is-oo type)
nil
user> (defmethod this-is-oo ABC [this]
(println (:name this)))
#<MultiFn clojure.lang.MultiFn@8625d0e>
user> (this-is-oo a)
Roger
user> (defmethod this-is-oo java.lang.String [this]
"Got a string and not ABC!!!!")
#<MultiFn clojure.lang.MultiFn@8625d0e>
user> (this-is-oo "a")
"Got a string and not ABC!!!!"
I find that I never use protocols or interfaces in Clojure, because most of the times I would use such things, if this were an object oriented language, I instead use multi-methods. This might be the point that runexec was making, as they write "Clojure can just do it better."
The key issue is polymorphism. All of us want to work in a language that gives us powerful forms of polymorphism. All of the major languages offer us some types of polymorphism, but let us ask, which gives us the most powerful and flexible forms? Myles Megyesi wrote a great article on this:
http://blog.8thlight.com/myles-megyesi/2012/04/26/polymorphism-in-clojure.html
2 common forms of polymorphism in Clojure, which Megyesi mentions, are:
1.) multi-methods
2.) functions as parameters
If you really like the object oriented style, you can imitate that style in Clojure by combining a record (a struct) with a multi-method, or you could just have a multi-method whose dispatch function checks and enforces a particular contract, or set of constraints (this is the style that I like best).
The crucial point to get is that multi-methods are the most powerful and flexible form of polymorphism that you can use. If you'd like to use a them in a traditional object oriented style, then you can match against the class or type of the arguments given to the dispatch function, but if you'd like to go beyond the traditional object oriented style, then you can match against any aspect of the arguments being given to the dispatch function.