Re: using Stuarts component library correctly

2014-08-11 Thread Sven Richter
Hi, Following the tips I removed the middleware wrappers, separated the handler and created closures over the routes. Now, when I do a reset after every change I am having a nice experience. So it was not much that was missing. Thanks everybody for your help, Sven Am Sonntag, 10. August 2014

Re: using Stuarts component library correctly

2014-08-10 Thread Matt Mitchell
Here's some relevant info about tools.namespace and protocols: https://github.com/clojure/tools.namespace#warnings-for-protocols - Matt On Saturday, August 9, 2014 6:04:03 PM UTC-4, Sven Richter wrote: > > Hi, > > First I would like to thank everybody for your answers and hints. > > I setup a sm

Re: using Stuarts component library correctly

2014-08-10 Thread Brendan Younger
Hi Sven, Take out the wrap-reload middleware in your routes. That's what's causing you problems. You will have to manually call (reset) every time you have a code change, but Stuart recommends binding it to a key sequence in you editor. Brendan On Saturday, August 9, 2014 6:04:03 PM UTC-4,

Re: using Stuarts component library correctly

2014-08-10 Thread Timothy Washington
If it helps, there's a lein plugin that creates a new component based app implementing the reloaded workflow. I haven't used it myself. But maybe it gets an initial version going, that you can build on. Tim Washington Interruptsoftware.com

Re: using Stuarts component library correctly

2014-08-10 Thread Sven Richter
Hi Alan, that's right, I did not call (reset) before reloading the page. But that's what happens sometimes, you change some things, don't call reset and then an exception will be thrown. Afterwards the state seems to be broken and nothing works anymore. In this special case, when I change the i

Re: using Stuarts component library correctly

2014-08-09 Thread Alan Moore
On Saturday, August 9, 2014 3:04:03 PM UTC-7, Sven Richter wrote: > > Hi, > > I setup a small project you can find here: > https://github.com/sveri/component_test > You can run it with lein repl and then calling (go). > 2. In scheduler.clj I defined a protocol (additionally to the lifecycle > p

Re: using Stuarts component library correctly

2014-08-09 Thread Sven Richter
Hi, First I would like to thank everybody for your answers and hints. I setup a small project you can find here: https://github.com/sveri/component_test You can run it with lein repl and then calling (go). I have three questions/problems for this one: 1. Did I separate the handler and the serve

Re: using Stuarts component library correctly

2014-08-09 Thread Matt Mitchell
I use a closure, but with a slight twist in handler definitions. I close over a "make-handler" fn with the system component.. which returns a middleware-wrapped, dispatcher fn; the thing that handles the routing logic to a particular handler fun. Each of my handlers are 2 arg fns: (fn [system r

Re: using Stuarts component library correctly

2014-08-09 Thread Brendan Younger
I've struggled with the same issue as you, Sven. In a web app, your handlers wind up needing access to every other component in the system because they are the first point of contact with the outside world. In my apps, I've done this one of two ways: 1. Close over the needed dependencies when

Re: using Stuarts component library correctly

2014-08-08 Thread Fergal Byrne
Hi Sven, I'm pretty sure that the purpose of Stuart's component library is precisely to capture these dependencies in your application, but to do so in a uniform, safe way which isolates the coupling to a small number of declared, explicit cases of mutual knowledge. In the case of the design you'

using Stuarts component library correctly

2014-08-08 Thread Sven Richter
Hi, I am trying to integrate Stuarts component library into my application. I am not sure if I use it correctly or do something else wrong or just have a wrong mindset. So I will explain how I am currently using it and the problem I see with it. I have three components: database, a scheduler a