<p>We have a simple domain model: Contact, TelephoneNumber and ContactRepository. Contact is entity, it has an identity field. TelephoneNumber is typical value object: hasn't any identity and couldn't be loaded separately from the Contact instance.</p>

<p>From other side we have web application for manipulating the contacts. 1st page is "ContactList", next page is "Contact/C0001" which shows the contact details and the list of telephone numbers.</p>

<p>We have to implement telepone numbers edit form. The first approximation thought is to add some page which will be navigable like 'ThelephoneNumber/T0001'. </p>

<p>But ThelephoneNumber is is Value Object class and its instance couldn't be identified this way.</p>

<p>What is the best practice for resolving this issue? How can we identify non-identifieble objects in the stateless applications?</p>

[{'answer_id': 72310, 'author': 'Marc Gear', 'author_id': 6563, 'author_profile': 'https://Stackoverflow.com/users/6563', 'pm_score': 3, 'selected': True, 'text': "<p>Does the value objects state identify that particular instance?  If not you could just pass back the old value and the new value when the edit form is submitted, then update any objects with the old state to the new state.  </p>\n\n<p>I would rather have a page like Contact/C0001/ThelephoneNumber, and use both the contact id and the value objects class to identify the instance you want to change.</p>\n\n<p>Unless I've completely misunderstood what you're asking.</p>\n"}, {'answer_id': 72316, 'author': 'auramo', 'author_id': 4110, 'author_profile': 'https://Stackoverflow.com/users/4110', 'pm_score': 0, 'selected': False, 'text': '<p>I would make the TelephoneNumber just contain a bunch of numbers (maybe make it plural), and refer to it this way: Contact/C0001/TelephoneNumber(s)</p>\n'}, {'answer_id': 72364, 'author': 'Leigh Caldwell', 'author_id': 3267, 'author_profile': 'https://Stackoverflow.com/users/3267', 'pm_score': 0, 'selected': False, 'text': "<p>In practice I always find it easier to give the telephone number an identity, even if it isn't strictly necessary in design terms.</p>\n\n<p>If it is a strict value object which cannot exist outside the context of the Contact, that indicates that a good user interface may call for the telephone number to be edited within the contact page rather than on its own page.</p>\n\n<p>However I think Marc Gear's solution is a good one if you decide against either of those two approaches.</p>\n"}, {'answer_id': 73085, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': "<p>Despite what many people would like you believe, you can't be 100% pure.</p>\n\n<p>Your value objects need some kind of Identity field. Sometimes it will be something unique for an object like a phone number, sometimes it will have to be something artificial, like TelephoneNumber.Id.</p>\n\n<p>The sooner you accept this, the better for you :-)</p>\n"}]
['https://Stackoverflow.com/questions/72218', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/9198/']