Skip to main content

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*

4
  • Indeed, this removes the need for using the file path as the identity. However, I'm anticipating the day when we don't want to manage files anymore, in favor of cloud resources for instance. So I'm wondering if can get rid of any aspect of the file in our BCs. Commented Dec 4, 2020 at 16:13
  • I guess the entities known to your business are some kind of documents, not files. I rephrased the value object to DocumentId. When you hydrate your document aggregates from the data source (here a filesystem) you do not need to know anything about files. I was assuming that anyway. So your aggregate would be something like Document maintained in the document repository. Only the repository implementation knows about files. When you want to switch to another data source you can simply change the concrete repo implementation leaving the repo interface including the DocumentId value object as is Commented Dec 4, 2020 at 16:45
  • If entities are considered as document, then the DocumentId would directly be the identity of the entity, isn't it? In practice, your solution may be totally useful. However, I have the feeling that adding a DocumentId property is not strictly DDD-compliant. Commented Dec 7, 2020 at 8:22
  • DocumentId is just a proposal for the name. The important thing is, that from how understand from your problem description, that this is really about documents existing in the problem domain of your business. Like a word document is known to the users of Microsoft Word. So I guess there is also some kind of identification of a document which the user of your desktop application is opening and saving to. So I do not understand why such an identification is not DDD-compliant. The value object can also be DocumentName or whatever makes sense in your domain. Commented Dec 10, 2020 at 19:21