On 5 Jul 2002, at 22:53, Dieter Maurer wrote:
Wolfgang Strobl writes:
... What is the purpose of myInstance._setId(id)? "_setId" is very well named.
This well chosen name makes questions as the above superfluous ;-)
I would have called it _set__name__, setName or something, but not setId.
Is it necessary? Each Zope site object needs an id!
But _setId doesn't set an id!
Depending on the object type, the id can be provided in a different way. But, it is a very good idea to use "_setId". This is very clear and explicit.
... Now _setObject in ObjectManager already adds a string attribute > named "id". Are you sure?
Well, I checked again. It creates a string property, but doesn't set a data attribute. Well, that's the problem with "using the source" when confronted with missing documentation and a somewhat baroque terminology: one sometimes fails. It's no replacement for specs and documentation.
When I just tried to verify your statement, I have been unable to see that the "set" object gets an "id" attribute...
But you noticed that _setId doesn't either?
So in fact _setId seems redundant and should be eleminated from the API. Don't remove the clear and well named methods from the API!
I'm still in search of a recipe how to tell clear and well named methods from confusingly and misleadingly named ones. Given that _setId doesn't do what it says, I'm not quite sure wether it is in the former or in the latter category. -- Wolfgang Strobl