The lesson began with the talk of yesterday’s lesson. Unfortunately I was not in so I can not comment too much about it.
But pupils had a problem that they could not implement a program, some made the program from scratch which was a waste of time as they could take the program before hand and change this. This is useful as it does not waste time going through a huge code again.
A program was described as Lego. You can build it and then finish it, it may look pretty but you can add pieces or take away pieces to make it a lot more complex and intricate. This idea goes with a program; you can also do this to a program which will make the program better.
The class was introduced to procedures. We had to understand the input and output and this was shown by a structured diagram- which is similar to pseudcode, but is a visual version of it. They can get complex on the other hand which is a disadvantage of using one.
Now using one, every one knows that efficiency is relevant! If we use the same part of a program then we don’t have to keep testing, error checking or even re-writing a program. This saves time and money and makes life easier…the phone went.
To start our structured diagram, we wanted a program that would add 2 numbers together and displayed the answer. It shows each different part of the program using boxes. It looks very similar to a family tree, with the sub-programs expanding down and then along to the right.
Parameter passing consists of a Global Variable (which is a variable which is used throughout the program) and a Local Variable (which is used at one part of the program). The input and output of the program we were writing contains a By Val and a By Ref. By Val is a copy of the variable (read only). And a By Ref is the actual variable (read + write) which can be changed at any time.
An example of parameter passing
1) Set up variables (BY REF)
Output NumA, NumB
2) Get 2 numbers
Input/Output NumA, NumB
3) Display Answer (BY VAL)
Input NumA, NumB
The phone wrung one last time before we left.
By Corrie 😛 x