I've dealt with a similar problem when creating Penumbra [1]. An 'app' has several mostly orthogonal pieces: window management, input handlers, action queues, and so on. From an implementation standpoint, it's very desirable to split these up, but we don't want to expose that to the user.
What I did was create several different protocols, and then create a type which has an instance of each. Unfortunately, we don't want has- a, we want is-a. But it's pretty easy to use extend-type to forward each call to the parent type into the appropriate child type. See the auto-extend macro at the top of http://github.com/ztellman/penumbra/blob/master/src/penumbra/app.clj for one way to do this. Keep in mind that this approach doesn't require that all pieces be orthogonal to each other, since you can instantiate one protocol with another. Using atoms, you can even handle circular dependencies. If you have any further questions, I'd be happy to answer them. Zach On Oct 15, 6:58 am, "K." <kotot...@gmail.com> wrote: > Hello, > > I'm a developping a Swing GUI in Clojure and follow the MVC patterns. > The view implements a protocol for displaying data, and another one to > register Swing listeners. Callbacks registered with the second > protocol only access the UI through the view protocol. > > Each of this protocol has ~50 functions (and it's growing every > day...). > > Even if I do some delegation when implementing these protocols, the > deftype implementation has already ~700 lines. > > Is there a way to split the definition in several files or namespaces, > or more generally, what would be the best way to organize this > architecture? > > I don't think subdivising the view in several views makes sense, since > from the point of view of the listeners it's really only one entity > (but maybe I'm wrong on this). > > Thanks in advance for your suggestions. -- 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