code design in clojure

319 views
Skip to first unread message

Brian Craft

unread,
Oct 17, 2012, 11:51:23 PM10/17/12
to clo...@googlegroups.com
I'm finding the books on clojure to be very focused on low-level language features. Are there any good references for how to design code in clojure (or perhaps in functional languages more generally)? For example, knowing when to use a data type or a protocol, knowing when and how to separate purely functional code from code with side effects, making use of monads, queues, and the other forms that one hears about in the forums, etc.

Alex Ott

unread,
Oct 18, 2012, 3:37:17 AM10/18/12
to clo...@googlegroups.com
Hi Brian

Which books had you read? I found that Clojure Programming provides
many useful tips on how organize code, etc.
> --
> 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



--
With best wishes, Alex Ott
http://alexott.net/
Twitter: alexott_en (English), alexott (Russian)
Skype: alex.ott

Roberto Mannai

unread,
Oct 18, 2012, 3:43:29 AM10/18/12
to clo...@googlegroups.com

- "Functional Programming for the Object-Oriented Programmer" (https://leanpub.com/fp-oo)
- "Clojure Programming" (see "Figure 18-1. Choosing Clojure type definition forms wisely", which in a data flow style leads you to the correct type choice)

Sean Corfield

unread,
Oct 18, 2012, 10:53:25 AM10/18/12
to clo...@googlegroups.com
Which books on Clojure have you read so far?

Brian Craft

unread,
Oct 18, 2012, 11:58:18 AM10/18/12
to clo...@googlegroups.com
"Clojure Programming", and "The Joy of ..." 

Sean Corfield

unread,
Oct 18, 2012, 1:01:13 PM10/18/12
to clo...@googlegroups.com
On Thu, Oct 18, 2012 at 8:58 AM, Brian Craft <craft...@gmail.com> wrote:
"Clojure Programming", and "The Joy of ..." 

Hmm, I was going to suggest Joy of but if you don't think that helps with some of those design issues, I'm not sure what to suggest. Others suggested Clojure Programming but, again, if that doesn't help...

At this point I'd certainly be interested in hearing suggestions from other people beyond those two books...?
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

Paul deGrandis

unread,
Oct 18, 2012, 1:02:03 PM10/18/12
to clo...@googlegroups.com
Brian,

Those are two excellent books.  If you are looking at more general project organization and approaches, I'd suggest:
 - Just Enough Architecture (specifically its discussion on architectural evident coding)
 - watch the Halloway talks on evident code
 - thumb through Ring, Leiningen, and ClojureScript as prime examples of well written Clojure applications
 - watch the Google tech talk on designing good APIs (http://www.youtube.com/watch?v=aAb7hSCtvGw)
 - and you might find a book like Higher-Order Perl helpful (depending where you're coming from)

Hope one (or all) of these help!
Paul

David Nolen

unread,
Oct 18, 2012, 1:06:22 PM10/18/12
to clo...@googlegroups.com
On Thu, Oct 18, 2012 at 1:02 PM, Paul deGrandis <paul.de...@gmail.com> wrote:
 - thumb through Ring, Leiningen, and ClojureScript as prime examples of well written Clojure applications

+1 

I think it's informative to look at non-trivial yet small Clojure libraries. ClojureScript doesn't quite fit the small requirement, but I think there's a lot to learn from looking at ClojureScript's analyzer.clj which is less than a thousand lines.

David

Roberto Mannai

unread,
Oct 18, 2012, 1:07:57 PM10/18/12
to clo...@googlegroups.com

See "Functional Programming for the Object-Oriented Programmer" (https://leanpub.com/fp-oo)

--

abp

unread,
Oct 18, 2012, 4:35:00 PM10/18/12
to clo...@googlegroups.com
You probably want to watch this:

Also, try to think of your programs in terms of pipelines as much as possible.
You get input, you produce output.
That probably applies to every program ever written, but when you get how that works in Clojure, it's like an enlightment, at least it was for me.
You can then structure all the processes in your program like that, and wire those up until you're done.

abp

unread,
Oct 18, 2012, 5:36:56 PM10/18/12
to clo...@googlegroups.com

Brian Craft

unread,
Oct 18, 2012, 7:07:31 PM10/18/12
to clo...@googlegroups.com
Thanks to everyone for the suggestions!
Reply all
Reply to author
Forward
0 new messages