Open LukeMathWalker opened 4 years ago
Hi! I like this idea a lot :) This is moving towards the "missing" application layer we discussed in another PR. One comment though - is that I think it's a nicer design to make the commands simple structs that are data only, and introducing one or more "application services" to handle them. This comes from domain driven design patterns - there is some discussion around this (happened to be in C# context - but still relevant): https://stackoverflow.com/questions/47991017/understanding-the-command-pattern-in-a-ddd-context I'm sure there are other good sources around the place too.
Just refactored to "flip" the relationship between commands and handler - let me know if this fits better with what you had in mind @colinbankier :grin:
:+1: I think it does :). Did you want to merge this as is, or keep working on this branch before merging?
Let me migrate all routes over and then we can merge :+1:
@LukeMathWalker - what are your thoughts on continuing in this direction? I like the idea a lot, but I'm also mindful of introducing unnecessary complexity - particularly if this is to serve as a "reference" for building tide apps. I'm happy if you'd like to continue in this direction however.
I think there are plenty of examples of "small" apps, but few of more complex setups and that's where I think this can be useful. I'd be happy to continue, time is my only constraint 😂
I'm happy to pick this up too from where you left off - how about I'll follow the example you set to convert all routes. It's been a while since I worked on this so this will be a nice thing to pick up.
Sounds good!
I wrote a quick stub of what it would look like to completely remove domain logic from our route handlers, moving them into domain commands. Curious to hear your feedback @colinbankier before moving any forward.