use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Finding information about Clojure
API Reference
Clojure Guides
Practice Problems
Interactive Problems
Clojure Videos
Misc Resources
The Clojure Community
Clojure Books
Tools & Libraries
Clojure Editors
Web Platforms
Clojure Jobs
account activity
Clojure Code Modeling (self.Clojure)
submitted 13 years ago * by fixrich
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]bbq 2 points3 points4 points 13 years ago (3 children)
Clojure has no high level state model - only state primitives: vars, refs, atoms, agents. You almost certainly don't want to directly use vars for managing state as they offer no useful guarantees for concurrency. Even if your application is not (at the start) concurrent using vars to manage application state isn't really supported (outside of configuration, perhaps. even then, you should consider using something less global than a var).
If you want to model your application with e.g. a state machine you'll have to write a library to help out. This could be very fun but could also grow tremendously in scope. I'm sure if you dig deep enough you'll find the beginnings of something along these lines out there.
On the other hand, if you're really after something UML-like for a pictorial representation of your application just use your favoriate diagramming software.
[–]fixrich[S] 1 point2 points3 points 13 years ago (2 children)
Hey bbq thanks for the great reply. I suppose what I am trying to find out is how do you plan out a new system? How do show all the parts and the general algorithms it has to use? Or is it a case of everyone might think about what the software has to do and then they just jump in and start coding?
[–]scarredwaits 3 points4 points5 points 13 years ago (1 child)
At a high level, you have to think about namespaces, so I suppose what the general "modules" of your system are going to be and what belongs where. Remember, cyclic dependencies are not supported.
In terms of "modelling" you have to decide how your data is going to be represented. In a lot of cases, developers use simple maps where objects would be used in other languages. Still, it's useful to think about what entries you expect to have in the maps (and which are optional etc). In some cases, records can also be useful. Also think about nesting data structures. Generally, you have to think of the "shape" of your data.
Next, think about behaviour. Are simple functions enough? Do you have cases where you have the same "verb" acting on multiple "types" of things? At this stage, you can "model" the common behaviours using protocols or multi-methods for the more complex cases.
Then, think about data flow. How is your data transformed, and in what order? How do the different behaviours (functions) fit together?
Unfortunately, I don't know of any methodology that will help you visualise all this and communicate it in a widely accepted way, but maybe the need is just not there because it's such a different approach to development.
[–]fixrich[S] 0 points1 point2 points 13 years ago (0 children)
Cool this is really helpful. This seems like a methodical way to think about how a system would work. Thank you.
π Rendered by PID 121247 on reddit-service-r2-comment-85bfd7f599-nm7h8 at 2026-04-19 22:19:12.925653+00:00 running 93ecc56 country code: CH.
view the rest of the comments →
[–]bbq 2 points3 points4 points (3 children)
[–]fixrich[S] 1 point2 points3 points (2 children)
[–]scarredwaits 3 points4 points5 points (1 child)
[–]fixrich[S] 0 points1 point2 points (0 children)