Presentation is loading. Please wait.

Presentation is loading. Please wait.

Thinking Ahead 2.2.2.

Similar presentations


Presentation on theme: "Thinking Ahead 2.2.2."— Presentation transcript:

1 Thinking Ahead 2.2.2

2 Starter Activity 3 mins Why Plan? Discuss

3 Learning Habits Which ‘Learning Habits’ we will need to make use of to be a success in this lesson? Noticing details Adapting : Reflecting and making changes Reasoning: Thinking rigorously, methodically and giving explanations. Empathising… …with feelings and views Effective use of time Questioning: Asking questions to get below the surface Listening… …to understand Imagining… …how things could be and seeing a range of possibilities Distilling… …what you have learnt and what you need to learn Collaboration: Working effectively with others Meta Learning: Talking about how you have been learning Imitation: Picking up good habits from others Independence: Working effectively alone Managing distractions… …and sustaining concentration Capitalising: Using resources purposefully Perseverance: Overcoming frustration and difficulty Planning… …your learning in advance

4 Lesson Objectives Lesson Objectives Success Criteria
a)    Identify the inputs and outputs for a given situation. b)    Determine the preconditions for devising a solution to a problem. c)    The nature, benefits and drawbacks of caching. d)    The need for reusable program components. Success Criteria To use the principles of forward planning and modular programming to create a set of programs which reuses code (instead of inefficiently re-writing the same code) Literacy – Key Words Caching Principle of storing data / instructions that are likely to be needed in the future, in system memory, so that they can be quickly accessed Modules Compartmentalising code, often so that it can be reused when required.

5 Thinking ahead Introduction Learning Objectives:
a)    Identify the inputs and outputs for a given situation. b)    Determine the preconditions for devising a solution to a problem. c)    The nature, benefits and drawbacks of caching. d)    The need for reusable program components. Introduction A vital skill in ‘Computational Thinking’ is to be able to think ahead. In other words, when solving problems, it is vital that we ‘PLAN’. Planning enables us to be more efficient when it comes to the time taken to solve a problem. For example, if you needed to deliver a set of parcels for various people in the area, you could pick up each box at random and attempt to find each address in turn. However, this is likely to be problematic… Do you know where each address is? Have you got a map? Do you know how long each route will take? Do you have enough petrol to complete the trips? Are there any addresses close to one another where you could make serval deliveries together?

6 Thinking ahead Introduction (continued)
Learning Objectives: a)    Identify the inputs and outputs for a given situation. b)    Determine the preconditions for devising a solution to a problem. c)    The nature, benefits and drawbacks of caching. d)    The need for reusable program components. Introduction (continued) In this example, without planning ahead it is likely that the deliveries will take a lot longer to complete. By thinking ahead, the driver would be able to use a map to ensure that he can drive the shortest route to all addresses, using a minimal amount of petrol. Spending a little time planning can result in saving huge amounts of time in the future. And the same principles can be applied when producing computer science related solutions. For example, if you needed to deliver a set of parcels for various people in the area, you could pick up each box at random and attempt to find each address in turn. However, this is likely to be problematic… Do you know where each address is? Have you got a map? Do you know how long each route will take? Do you have enough petrol to complete the trips? Are there any addresses close to one another where you could make serval deliveries together?

7 Thinking ahead Introduction (continued)
Learning Objectives: a)    Identify the inputs and outputs for a given situation. b)    Determine the preconditions for devising a solution to a problem. c)    The nature, benefits and drawbacks of caching. d)    The need for reusable program components. Introduction (continued) The following few slides will take you through some techniques that Computer Scientists can use to help them: ‘Think Ahead’, so that they can derive at their solutions in the most effective and efficient manner. Develop more efficient programs whereby the programs themselves can (in a way) ‘think ahead’, so that they can process data more efficiently.

8 Developers ‘Thinking Ahead’
Learning Objectives: a)    Identify the inputs and outputs for a given situation. b)    Determine the preconditions for devising a solution to a problem. c)    The nature, benefits and drawbacks of caching. d)    The need for reusable program components. Identification of inputs and outputs One technique that a computer scientist will use when creating a computer solution is to identify the OUTPUTS required from the solution and therefore the INPUTS (the data). The whole purpose of a programmer is to create a computer solution that meets the needs of the user. Considering that programs process inputs in order to produce appropriate outputs… …before a programmer can thinks about the algorithms required for each process, they first need to understand the outputs the user requires from the solution and therefore they need to understand the data required (inputs) in order to produce those outputs. INPUT PROCESS OUTPUT

9 Developers ‘Thinking Ahead’
Learning Objectives: a)    Identify the inputs and outputs for a given situation. b)    Determine the preconditions for devising a solution to a problem. c)    The nature, benefits and drawbacks of caching. d)    The need for reusable program components. Identification of inputs and outputs Suppose a client has approached you to create a program that will generate a report of all the sales made in their shop for a specified time period. The client has drawn up a mock-up of the expected report design: Question: What inputs would be needed in order to produce this report? INPUT PROCESS OUTPUT Inputs: Customer’s name Date of sale Time of sale Name of Item(s) bought Sale price of each item …and… Range of dates from which to generate the report Customer Date/Time Item(s) Total Sale Price Total

10 Programs ‘Thinking Ahead’
Learning Objectives: a)    Identify the inputs and outputs for a given situation. b)    Determine the preconditions for devising a solution to a problem. c)    The nature, benefits and drawbacks of caching. d)    The need for reusable program components. Caching A technique that a computer scientist may implement into their programs to ensure that they are as efficient as possible is caching. Caching is where inputted data is stored in RAM, just in case it is needed again before the process has been ended. Similarly, prefetching is where instructions are moved from the RAM to the CPU’s cache, before it is actually needed. Well developed algorithms can predict future instructions and so by ‘prefetching’ them, it means that are ready to be used instead of waiting for them to be read from disk. Advantages: Faster response times as data doesn’t need to be read from disk – they are already in system memory. Reduces the load on a system (fewer data access movements) Disadvantages: Very hard to program and apply successfully. If the wrong data is cached, the program could end up running slower.

11 Thinking ahead Preconditions and Reusable components?
Learning Objectives: a)    Identify the inputs and outputs for a given situation. b)    Determine the preconditions for devising a solution to a problem. c)    The nature, benefits and drawbacks of caching. d)    The need for reusable program components. Preconditions and Reusable components? Pattern recognition is an important computational thinking tool. It concerns the idea that similar solutions or processes (that have already been studied) can be applied to help solve the problem that one might be working on. If we were a chef in a restaurant and had an important customer who want a brand new ‘Super Special Pizza’ for lunch, we would first have to create a recipe. But a more effective approach would be to recognise that a ‘Super Special Pizza’ is similar to a ‘Standard Pizza’, just with a range of different toppings. So, to be efficient, we would borrow the pizza recipe so that half the problem is already solved, and just solve the remaining aspects of the problem. Programming languages have many libraries of functions / classes which we can make use of to solve many aspects of complex problems without having to code from scratch every time.

12 Thinking ahead Preconditions and Reusable components?
Learning Objectives: a)    Identify the inputs and outputs for a given situation. b)    Determine the preconditions for devising a solution to a problem. c)    The nature, benefits and drawbacks of caching. d)    The need for reusable program components. Preconditions and Reusable components? In addition to using prewritten code libraries to make the job of problem solving easier, it is also vital that programmers ‘think ahead’ to see if there are any modules of code (which they write) that could be reused in other projects that they might be working on, later down the line. For example, a programmer may have written some code which contains an algorithm for a unique calculation that a particular organisation uses in many aspects of its work. It may therefore by likely that this code will be essential in future programs required by the organisation. It would therefore be sensible to code this algorithm in a separate module which could be imported into future program with ease.

13 Lesson Activity 1 40 mins Create a module which consists of one function that will ‘take in’ one parameter (radius), and return the area of a circle with that radius. Then, create 3 separate programs which all need to access the function in this module. The first program will ask the user to enter the diameter of a circle and use the function to calculate it’s area. The second program will ask the user to enter the circumference of a circle and will then calculate it’s area. The third will ask the user to enter the length and diameter of a cylinder, the program will then calculate it’s surface area and volume.


Download ppt "Thinking Ahead 2.2.2."

Similar presentations


Ads by Google