Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

ObjectID Purpose

What is it for?

IObjectId Contract

For example:

Code Block
titleTestEquivilence.java


IUserIdFactory userIdFactory = new UserIdFactoryImpl();
String id = "foo";

IUserId objId1 = userIdFactory.createUserId(id);
IUserId objId2 = userIdFactory.createUserId(id);
assertTrue(objId1.equals(objId2));
assertSame(objId1,objId2);

What about:

Code Block
titleTestEquivilenceTwo.java

IUserIdFactory userIdFactory = new UserIdFactoryImpl();
IProfileIdFactory profileIdFactory = new ProfileIdFactoryImpl();

String id = "foo";

IUserId userId = userIdFactory.createUserId(id);
IProfileId profileId = profileIdFactory.createProfileId(id);
assertTrue(userId.equals(profileId));
assertSame(userId,profileId); // would this even be possible?

What does the IObjectId contract give us that equals() does not?
And can we create test cases to assert an implementations compliance to the contract?
Presumably there are cases where identity is a more complex thing than a String key.
Presumably there is a possibility for an object to want to operate on a collection of {{IObjectId}}s (say a cache).

ObjectID Refactoring

A picture of the IObjectId hierarchy prior to UPT-268 and after. IUserId is used as an illustrative example. The pattern is repeated for other I*Id interfaces.

...