|
|
|
Ask HN: UML-like diagrams for Lisp?
|
|
1 points
by cantelo
4647 days ago
|
|
After some years programming in Java and OO languages, I'm looking for a change and started learning Clojure and LISP. When designing a new application in Java or another OO language, I can sketch on a paper or imagine some UML diagrams that help me get an overview of the most important parts of the application. I find them useful, sort of a "mind map" for wrapping my mind around the whole application. These diagrams (class, component, objects) give me a high level of abstraction, allowing me to focus on the most important concepts and helping me exclude details that only cause an information overload when understanding the problem at hand. Now, while learning Clojure, I can't find an effective way to do the same thing. In OOP, objects and classes fit nicely in an UML diagram, but Clojure/LISP functions in an application are many, smaller and so much more difficult to fit in a small, clear diagram. How do you Clojure and LISP experts create a "mind map" diagram for the applications you are building? |
|
If you use classes and objects in LISPs (Common Lisp, Scheme, Clojure...), you can create the class diagrams and they will work. In Clojure I usually started (and I've seen others do the same) with some functions which operates over hash-maps (or a-lists in LISP). And on the end of the day, when I was creating the interface for call from java, I put the the needed hash-maps to defrecords. If I did the class diagrams, it was afterwards when the relationship between records was clear. Honestly, I don't usually create them anyway even at my work (C#) - only when the releationships between objects are complex or in some "unexpected" ways.
But other UML diagrams are perfecly applicable even in functional languages. The component diagram, use case diagram, communication diagram ... they are universal. The same for E-R diagram - if you use relational database in functional/logical language, it's sometimes good to have it.