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.
-
1would you mind to elaborate the benefits of allowing entities to meet their repositories? That reminds me to Active Record design pattern. Despite it's considered anti-pattern, I have found libs that implement it. So I'm missing the Pros. The cons I think are clear.Laiv– Laiv2017-08-20 20:05:06 +00:00Commented Aug 20, 2017 at 20:05
-
1@Laiv The critical difference between Active Record and entity being able to access it's repository is that, with Active Record, it is not possible to structurally separate the implementation of repository (eg. the SQL commands) from the entity/record. But having a middle man, like an interface, does make that possible. So for example, unit testing of entities, in isolation from persistence technology, becomes possible. Which is, I think, main complain when using Active records.Euphoric– Euphoric2017-08-20 20:15:34 +00:00Commented Aug 20, 2017 at 20:15
-
1ok. From the unit-testing standpoint, your approach is preferable. But what's the point of allowing entities to meet the DAL? Maybe I'm too oldschool or biased by too many years abstracting the model from everything else.Laiv– Laiv2017-08-20 20:22:25 +00:00Commented Aug 20, 2017 at 20:22
-
@Laiv Can you explain what you mean by DAL? Also, do you think domain should have abstraction of "collection of all existing entities" within itself? If yes, how is this abstraction represented? If not, how would domain express behavior that works on all existing entities? And by all existing entities I mean for example "all current vehicles".Euphoric– Euphoric2017-08-20 20:27:01 +00:00Commented Aug 20, 2017 at 20:27
-
Ok, ok. I think I got your point now. Basically you are looking at the repository as the collection of the existing vehicles while I'm still looking at it as a DAO. But still, should a single entity to be aware of everyone else (should a vehicle to have access the collection?) I guess the answer is no, and that's why you suggested the interface segregation, in order to don't force vehicles to be aware of the collection itself. I'm right?Laiv– Laiv2017-08-20 20:34:40 +00:00Commented Aug 20, 2017 at 20:34
|
Show 3 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