tag:blogger.com,1999:blog-6959582839690958035.post3024126682985903520..comments2023-09-15T11:15:54.222-04:00Comments on public void Life(): Agatha and a Unified Request Handler Theorytesthttp://www.blogger.com/profile/09609860522747123959noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-6959582839690958035.post-44308016834034395302010-05-05T23:19:51.039-04:002010-05-05T23:19:51.039-04:00Hmm... I might need a diagram or some example code...Hmm... I might need a diagram or some example code of how you are meaning to break it all out. I'm not sure what you are gaining nor if I understand what you mean.<br /><br />So the handler would inspect the request and decide where it was suppose to go? So the the same request type could be passed to different processor actions depending on input?Copenhashttps://www.blogger.com/profile/14860283098628466896noreply@blogger.comtag:blogger.com,1999:blog-6959582839690958035.post-33349022208249177232010-05-05T16:58:31.764-04:002010-05-05T16:58:31.764-04:00Looks like it's working, and I really like the...Looks like it's working, and I really like the design. Ya, I definitely need to draw a diagram with some class examples.<br /><br />The biggest challenge in implementing it at my current job is the sheer volume of legacy software. We're having some increasingly regular meetings to discuss the overall architecture and my input has been pretty well received.<br /><br />The direction we're going right now is to try to create a rough roadmap of where we are and where we want to be and try to come up with some discrete steps to get us there. If we can implement proper agile here (which my boss is all for, at least in talk) then my goal is to improve throughput enough to justify a day or two per iteration of infrastructure work. Kind of like how Google allows a day per week of research work.testhttps://www.blogger.com/profile/09609860522747123959noreply@blogger.comtag:blogger.com,1999:blog-6959582839690958035.post-21501377028243955062010-05-05T08:34:04.535-04:002010-05-05T08:34:04.535-04:00I think I may have found a fairly decent compromis...I think I may have found a fairly decent compromise, but we'll have to see how it works in practice. The goal was to reduce the number of disparate pieces of logic, right? Dozens of processor classes instead of hundreds (even thousands) of handler classes, so things could be logically separated into more intuitive business groupings.<br /><br />My idea fits with your quote about data structures... Basically re-factor the concept of the request and response. Instead of having many small requests and responses, have fewer large ones.<br /><br />So instead of a "GetUserProfileRequest" and a "GetUserRolesRequest" and so on and so forth, there would be a "SecurityRequest" which can cover many bases. The request would be populated with whatever the user has in order to get the data he needs. Then a handler custom to that request picks it up (like at our old job, not this Reflection loop I have) and the handler's only job is to see what the request has so it knows where to send it.<br /><br />The handler would send it to multiple domain methods based on what it looks like the requester wants. So each "processor" has a handler which directs traffic for that section of domain logic to the various methods in that processor.<br /><br />I'll have to put together a diagram for this and post it here sometime.testhttps://www.blogger.com/profile/09609860522747123959noreply@blogger.comtag:blogger.com,1999:blog-6959582839690958035.post-6428152367073769152010-05-04T22:09:59.122-04:002010-05-04T22:09:59.122-04:00So it sounds like you are trying to avoid having a...So it sounds like you are trying to avoid having a bunch of request handlers that are pass throughs. Perhaps refactoring what the handlers do is something to do. There is a refactoring pattern about removing a middle man that might be worth considering: <br /><br />http://www.refactoring.com/catalog/removeMiddleMan.html<br /><br />Also I kind of forget what the request handlers did for us at our old job. I believe they were to separate out the external service interface from the internal one. So they did server a purpose.<br /><br />Alternatively perhaps you remove the idea of the processor from the architecture. Just have the request handler perform the logic and have the dependencies needed for the action.<br /><br />Back to your code. Yeah some kind of data structure or use of an IoC feature that I'm not aware of needs to replace that double for loop that uses reflection. As 'The Cathedral and the Bazaar' says "Smart data structures and dumb code works a lot better than the other way around".Copenhashttps://www.blogger.com/profile/14860283098628466896noreply@blogger.comtag:blogger.com,1999:blog-6959582839690958035.post-64872804731067059332010-05-03T16:25:05.329-04:002010-05-03T16:25:05.329-04:00Ya, I definitely need to do a better job of abstra...Ya, I definitely need to do a better job of abstracting out my IoC stuff. I'm still learning the ins and outs of that.testhttps://www.blogger.com/profile/09609860522747123959noreply@blogger.comtag:blogger.com,1999:blog-6959582839690958035.post-28205011375017087742010-05-03T14:20:42.181-04:002010-05-03T14:20:42.181-04:00I need to read over the code and post again I thin...I need to read over the code and post again I think to fully understand but if you don't rely of StructureMap for any of it's features you could have your code just rely on CommonServiceLocator so anyone could use it with any IOC they wanted.Copenhashttps://www.blogger.com/profile/14860283098628466896noreply@blogger.com