written by owen on 2005-Mar-29.
A good program starts in the head of a programmer. You first consider whether the problem you are about to solve (aka the program) is impossible to write or not. In a class situation a teacher will usually give you a solvable problem.
When given a problem, a lab assignment or whatever, try to break it up into parts. Some parts of a program have to be completed before other parts and from this you should be able to figure out where to start writing your program. Think of it as a river (flow chart) that runs from the top of a mountain down until it reaches the sea. It is not a lake.
In most cases your program will involve some sort of menu. Think of the menu as a series of IF_STATEMENTS. If one thing happens THEN another thing happens and so on and so forth. Sometimes only after you start writing the program you will be able to finish it (hard to explain, look up momentum).
Things to do
Most new programmers often make the mistake of trying to put the entire program into their head - this is not good. Write little parts of the program one at a time ( in a logical order ).
- Do not write the entire program then try to compile it. A program works one line at a time. Start out by writing the first 5 lines of the program - then compile. if java sucks, compile after every 10 lines. This will help build up your skills and ensure that by the time you reach the end, the program will actually run with out errors. FIND AND FIX ERRORS AS YOU GO ALONG. Errors will be harder to find after you finish typing 500 lines.
- Look at other peoples code.
- Start writing the program
- Copy and paste. If you have written a similar piece of code before copy it and use it in you new program. Donot waste time writing it again.
- Ask questions, though they maybe stupid, its a learning process. Programmers become better through constant research and trial and error.
- Donot wait until the last minute to write you program, the sooner you start - the better.