Here's an important note about how to go about this:
(Much of the following probably won't make much sense until you've read the
details in Part A.)
Take some
time to think about what you’re writing. If you find yourself writing
code that looks very similar to code that you’ve already written, then what
does that suggest you should do?
Please do not
say “Cut and paste!” !!!!
You will
probably find a number of opportunities to fold otherwise repetitive code into a
small number of common (most likely private) methods – with suitable method
arguments.
For example,
you can cause an entry in one list to move to the other list in two ways:
- You can select
the item, and then click on the appropriate button, or:
- You can simply
double-click on the item.
Do not
write duplicated code for these two approaches!
Another
observation: The actions to move an item from the left list to the right
list are identical to the actions necessary to move an item from the right list
to the left list, except for which list is the source and which is the target. Again, try to avoid writing duplicate code!
By the end
of this course, I’d like to believe that you can all do appropriate factoring
of functionality to come up with a reasonably optimal, minimally code-duplicated
solution. So here’s an opportunity to practice that!
|