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.

5
  • 1
    In this instance (as it's a UK account) the account is identifiable by the combination of it's sort code and account number. If it were international then it might be different properties or an IBAN. Commented Apr 8, 2014 at 15:05
  • 1
    Good point. Then there might not be a need for Id at all. Commented Apr 8, 2014 at 15:07
  • 6
    When a relational DB is used, not adding a technical Id will lead to the usage of domain keys as foreign keys. So in this case, every table referencing the Account table will store a duplicate of the "sort number" and the "account number". Now imagine what will happen if some domain requirements change (like local country bank account numbers to be replaced by IBAN, as its currently happening in Europe). Believe me, the usage of technical IDs leads to much more stable models, avoiding a lot of real-world problem which you otherwise have to deal with. Commented Apr 8, 2014 at 16:08
  • 2
    As @DocBrown points out: resist the temptation to piggy back on a domain property - they're always prone to change (no matter how sure you are). That said, I consider the ID, or unique key, part of the domain model. Commented Apr 8, 2014 at 22:01
  • Agreed with @DocBrown, using existing concepts to function as identifiers may prove to be unstable, therefore in many cases it is required to create a new ID concept, as part of the model. Commented Mar 17, 2022 at 4:18