pseudo code possibly one of the hardest skills to get to grips with in learning a programming...
TRANSCRIPT
Pseudo CodePossibly one of the hardest skills to get to
grips with in learning a programming language is developing the ability to take a problem and break it down into a sequence of programming commands
If the task is simple …ProblemDeclare a variable to store the number of
students in a class
SolutionDim StudentCount as Integer
If the problem is complex...Devise a program that accepts monetary values
from payments. The payments represent part payment of money repaid against multiple loans. As the repayments come in, the oldest loan should be paid off first. Once the oldest loan is paid off the next oldest will be paid off, and so on until the most recent loan is paid. Any loans not paid off within an agreed time will require a reminder letter to be generated to the customer. After two reminders legal action will be taken.
Why is it more difficult to code compared to the first example?The problem is complexThere is no obvious 1 to 1 relationship
between the problem and the codeThe terminology of the problem is not always
clear on the first read and will almost certainly need clarification
You may not be sufficiently familiar with the programming language to know where to begin
“Find the SCORE with the problem” Sequence your tasks Choose your options Once may not be enough Recycle and reuse Evaluate and improve
Sequence your tasksWe have already seen the code for adding
a new swap
We shall take another look at it adding a break point to see the code working
Once may not be enoughRepetition or looping is an important feature of
any programming language
To see this working we shall look at the code for the search button on the main page
The looping is in the sub procedure ListMySwaps
Recycle and reuseSplitting the code into sections called procedures makes
our life a lot simpler
Take a look at the sub procedure ManageInterface on the main page
Try deleting the sub procedure and see what happens when you run the program
Also look at the function procedure LoginValid
Note the difference between a sub procedure and a function procedure!
Evaluate and improve Refine and improve means that we go through
our logic over and over again until we think we have identified all of the steps.
It is rare to get it right on the first attempt
Pseudo CodeOne big problem when learning a language is
that as a novice you will not be familiar with the code to know how to perform certain tasks and what is possible.
The best place to start with a coding problem
is to write out the steps in your own words.
Code TemplatesThese have been created to help you start
thinking about the structure for your code
'Step 1. write a description of what the code will do.'Step 2. list the inputs'Step 3. list the outputs 'Step 4. declare variables for inputs run and test'Step 5. declare variables for outputs run and test go to step 6'Step 6. assign values to the input variables run and test go to
step 7'Step 8. processing to go here develop and refine 'Step 7. assign output(s) to destination(s) run and test go to step 8