|
-
March 10th, 2011, 09:33 AM
#4
Re: Removing Bubbles on my grid
I don't understand how the code is supposed to work - there are no comments explaining what the methods do, the methods don't make sense, and the variable names are worse than useless - 'thisX', 'tempIcon', etc...
There's a 'move' method that takes a String argument that's never used, and recursively replaces the current cell colour with the colour of the cell above, replacing the top cell with white. What's that about?
Theres a 'goUp' method that takes a cell coordinates and the cell's icon, retrieves the cell component, compares the icon with the icon passed in (it's the same cell, so the icon will always be the same), and calls the 'move' method. Then it retrieves the same component again (why?) checks to see if it's still a label (how could it change?). If the icon wasn't changed by 'move' if calls goLeft, goRight, and go, passing in the original icon... ??
The 'goDown', 'goLeft' and 'goRight' methods look at the cell below, left, and right respectively, but I can't be arsed to figure out what they do after that.
Why does the 'move' method always just move up the grid?
Why doesn't the 'goUp' look anything like the 'goDown', 'goLeft' or 'goRight' methods?
I can't make any sense of it.
If I were you, I'd go back to my design algorithm on paper, step through a grid selection by hand and make sure that it works as specified - then go back to the code and make sure the code follows the design. Make sure that each method does only what you specified it to do - and make sure by testing it independently - if not by hand, with a unit test.
More than the act of testing, the act of designing tests is one of the best bug preventers known. The thinking that must be done to create a useful test can discover and eliminate bugs before they are coded - indeed, test-design thinking can discover and eliminate bugs at every stage in the creation of software, from conception to specification, to design, coding and the rest...
B. Bezier
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|