Okay, I have a fairly complex app I'm thinking of converting to clojure as a way to learn how clojure works. Here's how the basic structure of the app works:
1) Load a SVG (XML) file and parse it into a format usable by the program (convert strings to numbers, etc) 2) Persist the in-memory version of the file to the disk in a binary format that can be quickly loaded again 3) Perform some processing on the file (rotations, scaling, pasting between SVG documents) 4) Render the document using Java Graphics2D The current version of this code is written in Python, and is organized in the standard OOP form. Each element (e.g. Polygons, paths, images) are given a separate object that must implement a render() method. Loading, unloading, and persistence is all co-ordinated by the base object that calls child elements implementations of each function. So here's my question. In converting this to a clojure program, I see two methods: 1) OOP method where I have a separate protocol for each element 2) I divide the code into parts: a renderer, a persistance layer, a xml parser, then have multi-methods to override the behavior of each part. For instance: (defmethod render :image [context] (...)) (defmethod render :polygon [context] (...)) (defmethod render :path [context] (...)) (defmethod render :group [context] (...)) It's basically a question of grouping functions by the data or by the function they perform. Do I group all the render functions together or group all the polygon functions together? Timothy -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en