• Post Reply Bookmark Topic Watch Topic
  • New Topic

Could you criticize my implementation of the Tree?  RSS feed

 
Vladimir Bezugliy
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you criticize my implementation of the Tree?
Code locates here - http://jroller.com/page/vbez
 
Joseph Maddison
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It was hard for me to understand just what you were trying to do with the code. Maybe it would be useful to just spell that out.

One thing I noticed is that your delete node method does not recursively remove children and grand-children of the node to be removed, first, so they get orphaned when their ancestr gets whacked. Depending on the function of the tree, this may not be a big deal, but I thought I would mention it.

Also, I'm not sure that it is all that useful to have the serialization/externalization use XML. Unless there's a specific reason why not, you might as well serialize the entire tree and write it as an ObjectStream. It should do the job just as well, unless you need to be able to modify the data in the serialized state.

HTH,
jdmaddison
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!