2 Introductory Discussion? What problems are you faced with daily?Do you think a computer can be designed to solve those problems?Do you think that the computer is smarter than a human? Discuss.
3 The Role of the Computer Programmer Computers are designed to solve problems speedily and accurately.There is no problem that can be solved by a computer that cannot be solved by humans as well. It is just that it would take considerably longer for humans to solve it and the degree of accuracy would not be the same.Although computers are used to solve problems, they do not have brains. They cannot think. They cannot reason, although recent advances in artificial intelligence may seem to suggest otherwise.A computer is a moron – it simply does exactly what we tell it to do. This is why the role of the computer programmer is so important.There is nothing magical about the way computers solve problems. A computer simply follows (executes) a set of instructions given to it by the programmer and produces the specified results.
4 The Role of the Computer Programmer The computer programmer creates the instructions for the computer programmer to follow. If the computer produces undesirable results, it is not the computer’s fault; it is the programmer’s fault.Consider the following analogy:The food processor has buttons that indicate the various functions that can be performed – chop, grate, puree, liquefy, and so on. Now suppose you want chop some carrots to make a stew. You place the carrots in the food processor and press the chop button, but instead of chopping the carrots, the food processor purees it. The result is a stew that looks like a mush.Who would you blame for this undesired result? Would it be the food processor, the designer or yourself (the user)? Discuss
5 The Role of the Computer Programmer In this case:The user did what he was supposed to do (that is, press the chop button)The food processor did what it was supposed to do, that is, it carried out the instructions associated with the chop button.The designer is at fault here. Clearly the incorrect instructions were linked to the chop button.In a similar way, a computer carries out the instructions given to it by the programmer. The programmer must, therefore, ensure that the correct instructions are given at all times, and that the instructions are precise (accurate) and unambiguous (clear).Otherwise the results might be undesirable and in some critical situation such as airline navigation, the result could be fatal.
6 The Role of the Computer Programmer CLASS DISCUSSIONWhy are computers built to solve problems that the human brain can solve?Give some scenarios in which undesirable instructions in a computer can be fatal?How is a computer able to solve problems?A freezer was turned up to level 7 so that items could get well-frozen; the items were defrosted instead. What could be the cause of the error?
8 The problem-solving process The process of ‘Problem Solving’ is only a guide.It is useful to have a structure to follow to make sure that nothing is overlooked.Nothing here is likely to be brand new to anyone, but it is pure acknowledgement and reminding of the process that can help the problems to be solved.
9 Stages in the problem-solving process 2 Major Phases for the design of any computer programProblem-Solving PhaseImplementation PhaseStep 1: Define the problemStep 2: Problem AnalysisStep 3: Identify and evaluate possible solutionsStep 4: Select and justify the optimal solutionStep 5: Implementation and ReviewStep 1: Translate the algorithm into aspecific programming language.Step 2: Execute the program on thecomputer.Step 3: Maintain the program
10 Problem Solving Process – Stage 1 Problem DefinitionIf you don’t know what the problem is you cannot solve it (understand what is involved in a problem).The normal process for solving a problem will initially involve defining the problem you want to solve. You need to decide what you want achieve and write it down.Often people keep the problem in their head as a vague idea and can so often get lost in what they are trying to solve that no solution seems to fit. Merely writing down the problem forces you to think about what you are actually trying to solve and how much you want to achieve.
11 Problem Solving Process – Stage 1 Problem DefinitionThe first part of the process not only involves writing down the problem to solve, but also checking that you are answering the right problem. It is a check-step to ensure that you do not answer a side issue or only solve the part of the problem that is most easy to solve. People often use the most immediate solution to the first problem definition that they find without spending time checking the problem is the right one to answerTo understand the problem, you might need to ask yourself the following questions:- Can you state the problem in your own words?- What are you trying to find or do?- What are the unknowns?- What information do you obtain from the problem?- What information, if any, is missing or not needed?
12 Problem Solving Process – Stage 2 Problem AnalysisThis step involves determining what the inputs are, what processing is involved and what the outputs are.The next step in this process is used to check where we are and what the current situation is.Also determine how the data and information or results will be stored temporarily or for future use.Understanding where the problem is coming from, how it fits in with current developments and what the current environment is, is crucial when working out whether a solution will actually work or not.
13 Problem Solving Process – Stage 2 Problem AnalysisSimilarly you must have a set of criteria by which to evaluate any new solutions or you will not know whether the idea is workable or not.This section of the problem solving process ensures that time is spent in stepping back and assessing the current situation and what actually needs to be changed.After this investigation, it is often good to go back one step to reconfirm that your problem definition is still valid. Frequently after the investigation people discover that the problem they really want to answer is very different from their original interpretation of it.
14 Problem Solving Process – Stage 3 Identify and Evaluate Possible SolutionIn this stage you concentrate on generating many solutions and evaluating them at all.Very often an idea, which would have been discarded immediately, when evaluated properly, can be developed into a superb solution.At this stage, you should not pre-judge any potential solutions but should treat each idea as a new idea in its own right and worthy of consideration.
15 Problem Solving Process – Stage 3 Identify and Evaluate Possible SolutionThis section of the problem solving process is where you investigate the various factors about each of the potential solutions.You should note the good and bad points and other things which are relevant to each solution.
16 Problem Solving Process – Stage 4 Selecting and Justifying SolutionsThis is the section where you look at the various influencing factors or each possible solution and decide which solutions to keep and which to disregard.You look at the solution as a whole and use your judgement as to whether to use the solution or not. Sometimes pure facts and figures dictate which ideas will work and which will not.Evaluate or test the solution means to check the result to see if it is correct and to see if it satisfies the needs of the person with a problem
17 Problem Solving Process – Stage 4 Selecting and Justifying SolutionsThis is the section where you look at the various influencing factors or each possible solution and decide which solutions to keep and which to disregard.You look at the solution as a whole and use your judgement as to whether to use the solution or not. Sometimes pure facts and figures dictate which ideas will work and which will not.Evaluate or test the solution means to check the result to see if it is correct and to see if it satisfies the needs of the person with a problem
18 Problem Solving Process – Stage 5 Implementing and ReviewImplementing your solution is the culmination of all your efforts and requires very careful planning.The plan describes the sequence of actions required to achieve the objective, the timescale and the resources required at each stage. Ways of minimising the risks involved and preventing mistakes have to be devised and built into the plan. Details of what must be done if things go wrong are also included.Once the plan has been put into effect, the situation has to be monitored to ensure that things are running smoothly. Any problems or potential problems have to be dealt with quickly. When the action is completed it's necessary to measure its success, both to estimate its usefulness for solving future problems of this type and to ensure that the problem has been solved. If not, further action may be required.
19 Stages in the problem-solving process GROUP ACTIVITYYour group will research at least 2 stages in the Problem Solving Process.Stages 1 and 2Stages 3 and 4Stage 5I will assign each group to their stage(s). Duration:20 minutes2. Each group is expected to orally present their findings and source of information (URL) in a PowerPoint presentation. (5 minutes for each group)
21 How are instructions given to the Computer? Instructions are given to the computer in the form of computer programs.A computer program is a finite set of precise instructions, written in a programming language.Before we write a computer program , we first have to find a way to solve the problem at hand. After we have figured out how to solve the problem, we then translate the solution into a language that is meaningful to the computer.Giving instructions to a computer can be challenging at times and require a certain amount of skill. This is because giving precise, unambiguous instructions is not inherent in human nature. Humans tend to make assumptions when giving instructions and they expect other humans to reason things out in order to get to a logical conclusion.
22 How are instructions given to the Computer? Consider the following problem:You would like to give directions to someone to get to the nearest post office starting at point A.A possible set of instructions might be:Proceed a mile or so down the road until you reach the roundabout.Turn left at the roundabout and follow the road until you see a green house on the right hand-side.The post office is about the 3rd or 4th building on the right after the green house. You’ll see the sign in front, you cant miss it.CLASS DISCUSSIONDO YOU THINK THE INSTRUCTIONS ARE UNAMBIGUOUS AND PRECISE? What would you change or add to the instructions?
23 How are instructions given to the Computer? To the average person, the above instruction may appear to be clear and straightforward. However, once you start the following instructions, you may find that vital pieces of information may have been omitted and other bits of information might not be as precise as they could have been.For example, one might find that there is a junction or a fork in the road before one reaches the roundabout. This vital information was omitted so when the person arrives at the junction he/she would have to make a decision as to which way to proceed. Do I turn right, left or proceed straight ahead? Making the wrong decision could lead to all sorts of consequences.
24 We call the set of instructions an ALGORITHM. How are instructions given to the Computer?Let us carefully assess each instruction:“Proceed a mile or so” is imprecise. How far should the person have to walk or drive before arriving at the roundabout?What if there is more than one green house on the right? The instruction should precisely state whether it is the first, second or third green house that is being referred to.In the third instruction, it might not be difficult for a person to figure out whether or not the post office is the 3rd or 4th building. However, it would be impossible for a computer to execute on instructions written in this form. Computers must be told exactly what they must do in the correct sequence.We call the set of instructions an ALGORITHM.
25 ALGORITHMS HAVE FOUR VERY IMPORTANT ATTRIBUTES. How are instructions given to the Computer?ALGORITHMS HAVE FOUR VERY IMPORTANT ATTRIBUTES.They mustbefinite, that is,terminate aftera finitenumber of stepsThey mustbe preciseThe instructionsmust be in alogicalsequenceThey mustbeunambiguous
26 How are instructions given to the Computer? It is important to note that:Writing a program is simply a formal way of giving instructions to someone (in this case the computer) to perform a particular task. The only difficulty in writing a program is in knowing how to solve the problem.If you do not know how to get to the post office, you would not be able to give directions to someone. Likewise a programmer must figure out a way to solve the problem before he/she proceeds to tell the computer what it should do.
27 CLASS ACTIVITYArrange yourselves in groups of 4 or 5. Write the step by step instructions to solve one of the following everyday problem (10-minute exercise):Write a recipe for making a cheese omelette.Write the instructions to teach your mom how to retrieve voice messages from generic cell phone.Write instructions to give directions to a visitor to get to the Public Hospital from the school premises.Write instructions to tell a novice how to download music from the internet.Write the instructions necessary to determine if an unknown substance contains protein.Write a recipe to make a glass of lemonade.Note: No more than two groups should work on a particular problem.The instructions should be written on the board by a group member; the class should discuss the instructions given using the 4 attributes of algorithms to substantiate their suggestions.
28 How are instructions given to the Computer? CLASS DISCUSSIONHow are instructions given to a computer?Before instructions are given to a computer, what steps should be taken?Instructions given to a computer should have 4 important attributes; what are they? Discuss the importance of each attributes using relevant examples.