|
Re: Cleaned code up, but still need help.
|
Posted: Apr 11, 2003 8:47 AM
|
|
Hi...
I am having a few difficulties following your train of thought. At first, I thought I could concentrate on the matter at hand, but to me the code is so obscure that I digressed more and more. Finally, I came up with so many questions, because of contradicitons that I had already reimplemented the whole bag. I now decided to drop my catalouge of points and instead just give you a basic guide.
1. Use an IDE that helps you code. Eclipse (www.eclipse.org) or Netbeans (www.netbeans.org) are only a couple and can be obtained freely.
2. What do you think is the correlation between size, index and size()?
3. Make sure the iterator and the bag don't share variables (except for maybe(!) the wallet).
4. Make sure Iterator.hasNext() doesn't have any side effects...
5. Don't assume, the client fully traverses the collection using the iterator. She might as well only go half way.
6. Consider multithreading, too.
7. DRY - cf. Andy Hunt: "The Pragmatic Programmer".
regards,
Michael
|
|