Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
Hi there. Relatively new to Java. I have an assignment which is split into parts, based on a username/password idea. First part was to create a data structure appropriate for my project and I could add items to it. Done this using a Binary Search Tree. There appears to be no error in the code, but I can't figure out how to create a main method to make sure it works properly.
Any help with a main method would be greatly appreciated, grateful for any other suggestions or improvements. Thanks
First, your BST is tough to read, because you are incorporating 2 ideas into one class, where it would probably make more sense to break this into 2 classes: One for nodes in your tree, the other for the tree itself.... then the methods associated with each of these concepts (new nodes or adding to the tree) would be contained in their respective classes. this will make your code MUCH more readable.
There's a few issues with your code, that you should be able to work out after you start testing it. Lots of recursion in there for someone who doesn't have a grip on how to incorporate a main to test with, though...are you sure it's all yours?
To get you started, you can make a separate class or just write a main method within you current class to make it executable...then just declare your tree variable and have at it.