Presentation is loading. Please wait.

Presentation is loading. Please wait.

Pseudo Code Possibly one of the hardest skills to get to grips with in learning a programming language is developing the ability to take a problem and.

Similar presentations


Presentation on theme: "Pseudo Code Possibly one of the hardest skills to get to grips with in learning a programming language is developing the ability to take a problem and."— Presentation transcript:

1 Pseudo Code Possibly 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

2 If the task is simple … Problem Declare a variable to store the number of students in a class Solution Dim StudentCount as Integer

3 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.

4 Why is it more difficult to code compared to the first example? The problem is complex There is no obvious 1 to 1 relationship between the problem and the code The 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

5 “Find the SCORE with the problem” Sequence your tasks Choose your options Once may not be enough Recycle and reuse Evaluate and improve

6 Sequence your tasks We 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

7 Choose your options A good example to see this at work is the login process on default.aspx

8 Once may not be enough Repetition 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

9 Recycle and reuse Splitting 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!

10 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

11 Pseudo Code One 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.

12 Code Templates These 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

13 Questions Below is a section of pseudo code for a function that will look up the name of a person making an offer on a swap. Your task is to think about the logic for this task and put the lines of code into the correct order.


Download ppt "Pseudo Code Possibly one of the hardest skills to get to grips with in learning a programming language is developing the ability to take a problem and."

Similar presentations


Ads by Google