Factories

Learn what a factory is and how we can implement it to create complex entities in DDD.

As Eric Evans mentions in his book, there may be occasions when an object’s creation and assembly are complex. Such a process may need to orchestrate a lot of logic to create the complex object. With regards to this, he mentions an example related to the opening of a bank account. This process requires many objects in order to be executed properly. Oftentimes, the logic required to create those objects is not related to business logic, which can mess up the business logic. Refering to the Eric Evan’s example, let us imagine that the aggregate root of the bank ...

Access this course and 1400+ top-rated courses and projects.