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.
Required fields*
-
1I need only the customer's first and last name and the total number of their orders over $100. This would result in two queries and redundant data being returned, which is unacceptable.MrChudz– MrChudz2025-02-25 19:05:40 +00:00Commented Feb 25 at 19:05
-
1@MrChudz not if customer name is a domain objectBasilevs– Basilevs2025-02-25 20:26:09 +00:00Commented Feb 25 at 20:26
-
2@MrChudz - if I understood you correctly, your comment suggests that your domain objects closely mirror the database tables, while your DTOs are more in line with the use cases of your application (which ideally should be what the domain objects are doing). This design is what makes translating the queries unwieldy and far from optimal. I think this is also what Basilevs was getting at.Filip Milovanović– Filip Milovanović2025-02-25 21:01:24 +00:00Commented Feb 25 at 21:01
-
2@MrChudz "Often, we need to return only a subset of a domain model’s properties" - I know people call these entities "models", but that's a slight misuse of the term, and is now causing some confusion, because it's not what we're talking about when we say "domain model". It's not a particular class: it's the set of all the classes + the associated high level logic that forms the core of your domain layer and captures the essential aspects of the problem the application is tackling (meaning it is an effective in-code representation of it, supporting the needs of the application). 1/2Filip Milovanović– Filip Milovanović2025-02-26 20:31:09 +00:00Commented Feb 26 at 20:31
-
2So, it's not that there's some class that is designated a "domain model" and then you sometimes need to return "a subset of a domain model’s properties"; instead, if it's a legit use case, such a subset and the logic surrounding it is in some way represented within the the domain model (in this broader sense), it is a part of it (maybe it's a separate class, or a narrower interface, or maybe a part that you also reuse to compose the full object - how exactly is up to you and your understanding of the problem domain). Otherwise your domain model is not representative of your problem domain. 2/2Filip Milovanović– Filip Milovanović2025-02-26 20:31:11 +00:00Commented Feb 26 at 20:31
|
Show 5 more comments
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