Java Notes
Start with working program
If there is a program which is similar to the desired program, many professional programmers will start with the existing program and make alterations.
Find an existing program that's similar
Start with an existing program which is running. Use a previous program of your own, one taken from a textbook, or a program from these notes. There are several genericprograms in these notes that can be used.
Use part of an existing program
More common is that part of an existing program
will be useful. For example, the section
uses a GridBagLayout
might be something
to use as a model in your program.
It's sometimes harder to use only part of an existing
program because there are connections to
other parts of the program that might be hard to
untangle.
Don't plagiarize
If you're a student, don't copy an existing program and turn it in as your own. Even if the program is freely available, representing the work of others as your own is the academic crime of plagiarism, which is often severely punished. It's also amazingly difficult to plagiarize beginning programs unless they are very simple and everyone in class is writing the same program. I've had students turn in programs they found on the Internet, but it was easy to see that they used many features that the student couldn't possibly understand. In one bizarre case a student even turned in one of my programs as his own, after only changing a few variable names and comments.
The idea is not to copy a program in its entirety, but to start with another program or part of another program, then make it into your own with the necessary modifications. If the modifications are not extensive, give credit to the original author.
Check with your instructor
Altho this is a very productive standard technique, check with your instructor to see if this technique is OK.