I have never really taken it consideration of the reasons of why not to use ICloneable. I know not to do it, so have never had any issues. However the current project I am working has object inheriting from a certain base object that implements ICloneable (why? I don’t know).
Now the fact that none (or very few) of the ICloneable methods returned anything other than null, could have been the first sign that it might not be the best interface to implement. Then there are the deep versus shallow clone issues... who know’s what is doing what.. and then the returning of type object. Excellent. :(
Unfortunately it was a Microsoft consultant that apparently suggested using it.
Now we have a non standard clone implementation that some time does deep and sometime does a kind of shallow clone. Yuk. At least some of it is now documented.
As the classes are shared across other projects a cant just go an remove the interface… not that it looks like any one is actually using the method; as it is returning null everywhere… weird.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment