A method is a set of programming instructions for a computer. For example, a print method is written to print a document and a calculate method is written to calculate math. Pseudocode is lines of English that represent, but are not actual, computer code. It can use actual computer programming terminology or not, depending on the experience of the person writing the pseudocode. Pseudocode is like a first draft of code; it lets you see how things will look and whether they are logical before you spend hours writing real code that may not work.
Write down all of the methods you might need in your program. For example, if you're sorting information, you will need a sort method, if you intend to print, a print method and if you intend to calculate numbers, a calculate method.
Use a separate sheet of paper for each method for which you need to write pseudocode.
Write down all the steps you think are necessary for each method, with each step on a separate line. For example, for a sort method, you could write:
"Get table X;
Sort table X by Z category;
Display to user."
For a print method:
"Get document data;
Confirm printing arrangements;
Start with the first method you know you will need and break down each step into further actions if you can. Label each with the title that you intend to use during actual programming, such as "Sort()," "Print()" or "Calculate()." Review each step for logical sequence; each separate method must function in that particular order.
Put aside your new pseudocode for at least an hour. Come back it to it with fresh eyes. Review your steps and statements again for logical accuracy. This will help you catch possible errors you did not see previously.
Tips & Warnings
- If you are aware of programming syntax and terms, use them throughout the pseudocode as you write it. Indent to make each method more readable. For example, on one line you would write, "Calculate()"; skip down to the next line and indent at least five spaces and start writing the pseudocode that will begin the calculation process. Indent all lines until the method is finished. Write "End" under all of it, justified five spaces to the left of the indented pseudocode lined up with "Calculate()."
- Use the same naming conventions for all of your methods. If you don't, you will receive error messages within the coding section of the actual computer code later. For example, if you call the "Print" method in the pseudocode "Print()," do not call it "PrintDocument()" later on.
- Tech Terms: OOP
- "Programming Logic and Design, Fifth Edition"; Joyce Farrell; 2008
- Oberlin College Computer Science; Pseudocode; Passing Parameters to Methods
- Photo Credit Stockbyte/Stockbyte/Getty Images