4

There is nothing inherently wrong in making the User object a facade to certain user related functions of the service. As long as it delegates the more complex operations to other, maybe internal classes, this does not make the User a God object. Note also the User class in the content service context is a different one than the User class in the ...


2

In general, using transactional consistency would require a central authority, like a database. So you could perform operation A B and C in a single database transaction and ensure that either all succeed or all fail. If this is not possible, due to having distributed services for example, you are forced relax the consistency requirement. For example, if ...


2

const emailService = process.env.NODE_ENV === 'production' ? new EmailService(new Sendgrid()) : new DummyEmailService() That pattern I recognize as a feature flag A simple approach which at least allows feature flags to be re-configured without re-building an app or service is to specify Toggle Configuration via command-line arguments or environment ...


1

Foreign keys are to databases what security belts are to cars: they can prevent damage caused by ill-behaving applications or unanticipated circumstances. But you should better prevent those accidents in the first place. First of all, foreign key validations by the database come too late. Normally you should make sure well before that the key would be valid. ...


1

TL;DR: Yes, for most cases there is a better option. That is to concentrate on behavior / functionality instead of modeling the database. If you think about foreign keys and potential lazy loading problems it is clear that you are thinking about the database. You probably model database rows as objects, that is why you are concerned with technical details. ...


1

An AGGREGATE is a cluster of associated objects that we treat as a unit for the purpose of data changes -- Evans, 2003 In my experience, this is usually interpreted as an expression of domain invariants (how information changes) rather than access control (who does the changing). Consider chess: we have players moving the white and black pieces, where each ...


1

What since entities !== what we get via the API and what get saved in the DB, what layers should perform that transformation? Parsing the request, by which I mean taking the representation of the information you get from your general purpose HTTP library/framework and converting it to an in memory representation of the API message, is normally an activity ...


1

Am I correct in thinking that when I receive data in the controller I would pass this over to the service, at this point the service should first fetch that data from the repository and then map it into a domain entity. It is the domain entity, that will house rules for update, once the operation is performed we would pass this back to the repository. ...


1

When applying DDD patterns it’s common to have a repository per Aggregate. This makes sense, because the Aggregate is a consistency boundary. Evans wrote: An AGGREGATE is a cluster of associated objects that we treat as a unit for the purpose of data changes. Each AGGREGATE has a root and a boundary. The boundary defines what is inside the AGGREGATE. The ...


1

The general solution to this is to have a clean up check which runs periodically. Service C: Perform Operation C Close A (via message to A?) Service D: Look for all open Operation A's Check related operation B and C have successfully completed within allowed time span. If not. Flag for intervention/Take remedial action This allows for ...


Only top voted, non community-wiki answers of a minimum length are eligible