--
Omnem crede diem tibi diluxisse supremum.
I wonder if watching this talk by Rich Hickey will help?
http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey
It focuses on issues with mutability in the context of OO.
--
Sean A Corfield -- (904) 302-SEAN
Railo Technologies, Inc. -- http://getrailo.com/
An Architect's View -- http://corfield.org/
"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood
> So in idiomatic Clojure applications, maps are considered like
> objects?
> And to operate on them we pass them to functions?
I think that considering maps as a state representation is reasonable. There are alternatives, but that's fine-tuning I think.
There's a lot you're going to have to take in, but I suspect the biggest sticking point will be around values/immutable-state, references to that state, and when/how the reference changes. When you get this, you'll be able to see how state/reference/time relate to the OO concepts you already know. At which point you'll be laughing.
I don't remember anybody I've worked with that has had any difficulty with picking up functional programming (aside from the immutability thing). It's one of those things that changes how you work forever -- you are going to feel pain when working with Java :-)
I strongly second the recommendation of the book "Joy Of Clojure" as a next thing to read (it's from Manning and you can get from their MEAP in pdf/epub formats)
Cheers,
Bob
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@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+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
----
Bob Hutchison
Recursive Design Inc.
http://www.recursive.ca/
weblog: http://xampl.com/so
Reading a bit about OOP in either Common Lisp or Dylan might help ease you into
'thinking clojure'. It can provide a bridge between then Java OOP way
and other ways of doing OOP.
I had the opposite problem from you. When I started programming,
Dylan and Common Lisp style OOP made far more sense to me then the C++/Java way
( and the Smalltalk way but I didn't want to group it with C++/Java ).
There is a fundamental
difference in OOP in Lisp style languages from the Algol ones and
knowing more about those
other forms of OOP might make the path easier to see.
There is an older Guy Steele essay that talks in part about Scheme and
OOP ( something
that most people consider anti-ethical )
http://dreamsongs.com/ObjectsHaveNotFailedNarr.html
Basic message, some form of OOP is possible in any language, it is
just how easy it is made.
As David said, I would be careful about reaching for the methods in
Clojure that makes OOP
easier and work more with maps, vectors, fns etc and then look at the others.
-
for more info on OOP in dylan see:
http://www.opendylan.org/books/drm/
for more info about OOP in Common Lisp, I would recommened:
One of the things that stuck out for me that I heard somewhere (can't
remember exactly) was that OOP is about framing questions in terms of
"nouns" and FP is about framing questions in terms of "verbs."
Partly for my own benefit (and the list's critique and refinement) I
want to talk about this as it relates to an example. The first task
I'm working on in Clojure is taking a text file which is sortof a
template, and then removing/adding/changing certain lines/strings in
it based on an xml kindof config file, in the end spitting out an
improved text file.
If I was in the OOP frame of mind, I would have a class to represent
my text file, and a class to represent my xml file. There would
possibly be a shared base class to let me share the common slurping
(reading of lines) from the files. As verb-y as that is (I hope
Clojure is polluting my thought process already!) the base class would
probably be called "File" or something super noun-y. In any case, the
classes, the files, these are all "nouns."
But in the FP frame of mind, I just have data or information, and the
focus is on the transformations that I do with the data. The
transformations are things like zip-my-xml-into-a-struct-map or
read-my-lines-into-a-seq and replace-text-values-with-xml-values. The
focus is on the actions (verbs being action words), and the functions
are essentially the "verbs."
I feel like I'm starting to get the concept of thinking in a
function-al way, although I have a lot of work to do yet on learning
Clojure the language.
HTH,
Peter
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@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+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
--
The king’s heart is like a stream of water directed by the Lord; He
guides it wherever He pleases.
Perhaps you heard it in Yegge's enjoyable essay:
http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html
--Chouser
I'd go over SICP, though it not in Clojure but in Scheme - it will
show you how to "think" functional.
i think some folks argue that
http://www.htdp.org/
is even better :-)
or at least a good 'nother one to skim.
sincerely.