You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
- 2If you weren't writing this in DDD, which approach would you take and why?Robert Harvey– Robert Harvey2021-01-26 21:00:10 +00:00Commented Jan 26, 2021 at 21:00
- @RobertHarvey, thanks, I was hoping you would notice this question. That said, I don't want to answer your question because, in all honesty and humility, I don't think I have ever gotten this right in all these years. Ugh. Anyway, to answer your question, if no DDD, I would put it in the "query" to the database, wherever that be, only to avoid load ALL objects in memory.OR, I would load all Product IDs by query, pass it to Business Logic layer, let that layer run the filter and pass them back to App layer, and finally query database to bring whole entities for the filtered IDs.Krishnan– Krishnan2021-01-27 21:09:52 +00:00Commented Jan 27, 2021 at 21:09
- Hmm.. maybe I misunderstood your question. So... Not thinking about "DDD", I would probably choose Approach 4 as it has the cleanest and most flexible design. But it is complex, no doubt. So until I can buy time to implement it, I would settle for Approach 1 as it will be the most performant.Krishnan– Krishnan2021-01-27 21:19:05 +00:00Commented Jan 27, 2021 at 21:19
- 1I don't understand why you chose to use two separate domains. The products for both use cases / user stories are the same products, so to me the difference in usage for these two users does not justify making it a separate domain. Coupling between domains should be as little as possible and by making this two separate domains, you have the entire product as coupling. I would make it one domain with two functions in an aggregate root.Quido– Quido2021-01-28 10:45:37 +00:00Commented Jan 28, 2021 at 10:45
- Got your point. Consider them as sub-domains if not domains. The primary motivation was that Admin operations are auxiliary to the final Store App. In other words, the Store App can exist independent of how its Products data is populated. Anyway, if I go with your approach and merge them, the question still remains: where should I place that domain query logic? Combining your reasoning to have a single domain and the answer from Fabio below, I feel that I am getting closer to understanding my domain better. I'll add further comments and mark an answer soon. Thx!Krishnan– Krishnan2021-01-29 04:24:54 +00:00Commented Jan 29, 2021 at 4:24
Add a comment |
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
- create code fences with backticks ` or tildes ~ ```
like so
``` - add language identifier to highlight code ```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible) <https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. design-patterns), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you