domain-driven-design

microservices and bounded contexts

扶醉桌前 提交于 2019-12-25 07:25:01
问题 For the sake of question, let's say i have 2 microservices. Identity management Accounting I know that each microservice should not be tightly coupled and it should have it's own database. Let's say that accounting has invoices and each invoice has issuing agent. Agent from accounting also exists as User in Identity microservice. If i understood well, data from identity management (users), should be copied to accounting (agents), and should copy only data which are needed for that bounded

laravel eager loading to minimize queries

妖精的绣舞 提交于 2019-12-25 05:12:15
问题 I am using laravel with DDD Pattern and here is my code to make some analytics report for website... My code from Repository... //Abstract Entity public function getFirstBy($key, $value, array $with = array()) { return $this->repository->getFirstBy($key, $value, $with); } //Link Entity $link = parent::getFirstBy('hash', $data['hash'], ['visits']); //prepare report $report = []; //get dates difference $date1 = new \DateTime($data['from']); $date2 = new \DateTime($data['to']); $date_diff =

Refactoring code using Strategy Pattern

一个人想着一个人 提交于 2019-12-25 04:48:17
问题 I have a GiftCouponPayment class. It has a business strategy logic which can change frequently - GetCouponValue(). At present the logic is “The coupon value should be considered as zero when the Coupon Number is less than 2000”. In a future business strategy it may change as “The coupon value should be considered as zero when the Coupon Issued Date is less than 1/1/2000”. It can change to any such strategies based on the managing department of the company. How can we refactor the

In Zend_Auth, can I get a domain-model User object instead of stdClass?

喜欢而已 提交于 2019-12-25 04:35:10
问题 While working on the login part of an application, I find myself running into an issue: My model is based on Active Record, by extending Zend_Db_Table_Row objects. Whenever I have to deal with a user, I'd want to do this through the User object (being an extended table row). However, Zend_Auth_Adapter_DbTable::getResultRowObject() returns a stdClass and I can not find a way to tell Zend_Auth_Adapter_DbTable to use a specific Db_Table. My three options that I've found so far: Write a custom

Specification Pattern vs Spec in BDD

耗尽温柔 提交于 2019-12-25 03:45:10
问题 I'm trying to explore Behavior Driven Design and Domain Driven Design. I'm getting that written specifications drive the tests in BDD, but also that business logic can be encapsulated using the specification pattern for re-use in domain objects and repositories, etc. Are these basically the same concept just used in different ways, used in conjunction together, or am I completely confusing the concepts? Please shed some light, if possible. 回答1: BDD or context specification is a style of

How to model the requirement using domain driven design

家住魔仙堡 提交于 2019-12-25 03:13:44
问题 I have a requirement where i need to group the two events as one transaction by grouping them on certain criteria. Below is the some thoughts on the requirement. Event :: We will receive events continuously to our systems. Each event will have some buffer time to group with other event. If buffer time elapses then we need to discard the event. We need to group the two events into one group depending on the two events information. If event information is not sufficient then we will send event

Paging in NHibernate

十年热恋 提交于 2019-12-25 02:47:44
问题 Lets say I have a domain model with a class called Blog that has a property called BlogEntries (that contains objects of type BlogEntry). If I have a database model with two tables "Blog" and "BlogEntry", it's not impossible that I have 1000 blog entries for a blog. If I were to show the blog on a web site, I would only want to display maybe 20 blog entries at a time, so I would have to use some sort of paging. I obviously don't want 1000 records to be fetched from the DB all the time. How

Integrating DI container within domain layer. Domain events

情到浓时终转凉″ 提交于 2019-12-25 01:49:13
问题 Following the article: http://www.udidahan.com/2009/06/14/domain-events-salvation/ we can see that DomainEvents implemantation uses DI container public static IContainer Container { get; set; } and then if(Container != null) { foreach(var handler in Container.ResolveAll<Handles<T>>()) handler.Handle(args); } Should I integrate DI container inside the same assembly I store domain objects or can I externalize/abstract away the Container.ResolveAll<Handles<T>>() ? (In my previous experiences I

Reference another Aggregate Root inside another Aggregate root?

馋奶兔 提交于 2019-12-25 01:45:21
问题 I'm done DDD for a couple of years now and still its challenging when it comes to designing Aggregates. Thats the fun part of DDD and it makes your head spin. I'm asking this question since I'm architect in a project and we're in the middle of designing the model. Its an iteration when model evolves parallel with GUI and requirement gathering together with customer. Now to the problem. Our scenario is that we are facing some Aggregates that are growing into very large AR's. I think I'm good

Entity Framework 4.1 - Code first. Doesn't EF override my virtual members?

我与影子孤独终老i 提交于 2019-12-25 00:30:00
问题 I’m building a system using domain driven design and EF 4.1. In some of my properties I have logic preventing illegal values to be set and if so throwing an exception. I thought EF, when instantiating my classes, created a new temporary class e.g. MyClass_abc123… inheriting from MyClass that overrides all virtual members to be able to set them with data from the DB. When EF instantiates the class below and try to set the property MyObj the exception is being thrown. Anyone got a clue or a