[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[smila-dev] new datamodel : Id got replaced by String
- From: Thomas Menzel <tmenzel@xxxxxxx>
- Date: Mon, 28 Mar 2011 12:44:48 +0200
- Accept-language: en-US, de-DE
- Acceptlanguage: en-US, de-DE
- Delivered-to: firstname.lastname@example.org
- Thread-index: AcvtNSeWLDqbWuFHSj6zBwpHhtLLsg==
- Thread-topic: new datamodel : Id got replaced by String
I have noticed that the new model removed the Id Interface and replaced it with String.
While I understand the motivation to make things simpler and acknowledge that Strings are the most common form of ids in use, I would have highly recommended to stick to an Id Interface, having the gut feeling that we would have been better off doing so. but maybe it's not too late...
These 2 advantages come to my mind:
1. the code/API becomes more verbose.
just looking at the type u know what it is used for. this is tremendously helpful in maps, e.g.:
- Map<String, String> could be meaning: Map<Id, String> or Map<String, Id>
- process(Blackboard blackboard, String recordIds) vs. delete(Blackboard blackboard, Id recordIds)
2. Being able to provide own impl. against an Id Interface might be very useful in certain circumstances and alleviates to need for help classes to construct proper String from a richer Object.
declare an interface: Id extends CharSequence.
ATM I don't see a need for more methods than what the CharSeq provides. The internal default impl. could use Strings.
Thomas Menzel @ brox IT-Solutions GmbH