- #Domain driven design services update
- #Domain driven design services software
- #Domain driven design services code
I try to avoid that kind of services and instead break those down to smaller atomic commands.Įach command can be exposed as an operation, or you could have a single service operation that receives groups of commands and then delegate those to command handlers.
#Domain driven design services update
Maybe the problem you are facing is that you create services like "UpdateOrder" which takes an order entity and tries to update this in a new session? Var customer = customerRepo.FindById(customerId) Var customerRepo = new CustomerRepo(uow) Void RenameCustomer(int customerId,string newName) Just model your service operations as atomic domain commands. I also don't see what the problem is with ORM and services, you can easily use a session/uow per service call. You create a domain model that encapsulates your domain concepts, and expose entry points into that model via services. IMO, they are two concepts that work great together I think a common misconception is that SOA and DDD are two conflicting styles. The truth is, I don't think I really even know what DDD is? Like I said, maybe I'm just not grasping DDD or maybe I'm over analyzing my designs? Maybe by using the patterns and concepts DDD has taught me I am using DDD? Not sure if there is really a question to this post but more of thoughts I've had when trying to figure out where DDD fits in overall systems and how scalable it truly is. I am starting to think DDD doesn't fit in large systems but I do think some of the patterns and concepts do fit in large systems. I've noticed I really only use some of the concepts and patterns DDD has taught me but the overall architecture is still SOA. However, ORM just feel like they don't fit in a stateless architecture. I know there are ways around it, for example use IStatelessSession instead of ISession with NHibernate. I've even tried using ORM's but they just don't seem like they fit in a stateless architecture. I use good DDD principles like entities, value types, repositories, aggregates, factories and etc. Now when I develop a new service, I try to think DDD in that service even though it doesn't really feel like it fits. Every physical layer is load balanced too. Only Server 1,Service 2,Service 3 and Service 4 can talk to the database and the Main Service calls the correct service based on products ordered. At work our systems are load balanced and designed not to have state. This year I've been trying to do more DDD but I keep getting the feeling that I'm not getting it.
#Domain driven design services code
I've always developed code in a SOA type of way. To read more around that, you can check this article. As he has said, DDD is not for perfectionists, meaning that there might be cases, where the ideal design does not exist and you might have to go with a solution, which is worse in terms of modelling. Like I said, maybe I'm just not grasping DDD or maybe I'm overĮxcuse me, but I'll have to quote Eric Evans one more time. So, this trade-off should always be kept in mind, DDD is not a silver bullet. If you'd like to calculate the order's total amount strictly following DDD, you'd have to load all the order items in memory, which would be extremely inefficient compared leveraging your storage system (e.g. For instance, imagine a retail system, where each order is an aggregate containing potentially thousands of order items. In the video I've linked above, you can also find Eric explaining that DDD concepts can "break" in very large-scale systems. Some of the patterns and concepts do fit in large systems. I am starting to think DDD doesn't fit in large systems but I do think
#Domain driven design services software
They force the software towards an anemic domain model, where classes end up being "plain data holders". This is because, they're trying to bridge the object-relational impedance mismatch, but in a wrong way. However, you're right, ORMs do not fit nicely with DDD as well. I don't have any reference handy to back this up. I've even tried using ORM's but they just don't seem like they fit in You should also check this video (especially the last 5 minutes), where Eric Evans discusses exactly this topic. classes in case of object-oriented programming) align directly with concepts of the business. DDD is mostly about trying to model your software, so that all the concepts (i.e.