![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
|
review javadocs and method design
I have uploaded the pdf that describes the homework assignment and a "jar.zip" file. remove the .zip part to double click and run. the source is inside of the "jar.zip"
I am new to using javadoc and find myself at a loss as to what to write. The comments always seem pointless because params and methods are rather self explanatory. I feel as though I end up repeating myself when describing many methods. particularity one's with return statements where I have to comment the return value and what the method dose. I would like advice on how to do javadoc commenting as apposed to normal commenting The part I'm most concerned about is the add method in ShoppingCart. I know it works but I don't think it is the best way of doing it. Every time a textfield in the GUI has action with a valid number it sends a new ItemOrder object to ShoppingCart to add to an array list used for computing the cost. So when changing a textfield from one number to another the last occurrence of that same order must be removed or altered to reflect the new change. After those two issues would you please give a over all look at the logic and design I used. Thank you.
__________________
i dont know much about programming but i try to help |
|
|
|
|
|
#2 |
|
Hobbyist Programmer
|
Re: review javadocs and method design
My main question is about this add method in ShippingCart class. It is called every time an action occurse in a text field where quantity requests are entered. So when a selection of 5 stickers is made 5 ItemOrder objects are added to an array list called my_order_list. Changing an order from 5 to 3 sends 3 ItemOrder objects to the list. This new quantity has to replace the old one in the array list. ItemOrder can return a string representation of the order requests. I use this string to compare ItemOrders in the arraylist. If a new request's string matches one already in the list I over write it with the new one else I add the new request.
OK so here is my question. Is this line 100% A OK java goodness? if (the_order.getItem().equals(my_order_list.get(i).getItem()))Do i need to override some thing or use some other method instead of equals? Am I comparing the right things( strings or hash codes)? Im not sure of the inner workigns of java that this may relate to so I dont know if the above line is correct. java Syntax (Toggle Plain Text)
java Syntax (Toggle Plain Text)
Thank you.
__________________
i dont know much about programming but i try to help |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|