Chapter 1- Computational Thinking Notes “Computational thinking is a problem solving approach that borrows techniques from computer science, notable abstraction, problem decomposition and the development of algorithms. It is applied to a wide variety of problem domains and not just the development of computer systems.” Seymour Papert first used the term computational thinking in 1996. He is a computer scientist who helped to develop logo, a language that aimed to help students think computationally. Computer systems are extremely difficult to develop, even simple projects become complex, this means that different methodologies have been developed to help with this and keep larger projects under control and manageable. Development of systems has also helped to understand things other than increasing the use of computers. It has helped discover things about the universe and our own bodies, and the realisation that we are too made up of digital information in the form of DNA. Jeannette Wing, in the USA, has helped to publicise computational thinking. Jeannette Wing is Corporate Vice President of Microsoft Research. She has worked in multiple universities, including Carnegie Mellon University in Pittsburgh where she was President’s Professor of Computer Science. How computers help us think: We can get the technology to do hard work for us, problems that would of used to take a lot of time and hard work can be completed much more quickly. This means that in order to make use of a computers power and speed, we have to approach problems differently. By creating smaller problems for the computer solution, we can understand the problem better. By having an understanding for how computers store and process data, it can provide us with analogies for understanding how the world works. Examples of computational thinking: Creative processes have been changed dramatically, we can now use word processors, for example, that allow us to easily change what we write, rather than copious crossing out and help to organise things like notes. The Human Genome Project used computers to process vast amounts of data. As suggested by Jeannette Wing, computational thinking can now help us: o Asses how difficult a problem is. o Use recursion to apply a simple solution repetitively. o Alter the way we look at a problem to make it into something we understand more easily. o Model a problem so we can create a program to be run on the computer. o Scale solutions to help on a larger scale. Breaking down problems: “Decomposition is the breaking down of a problem into smaller parts that are easier to solve. These can sometimes be involved recursively.” This approach was called top down design, it led to widespread use of modular programming where there are many benefits such as assigning certain parts to a certain programmer to make use of their strengths. It is often hierarchical where each sub-problem leads to smaller ones, like a family tree structure. It is less useful for modern, more complex projects. Top down is not the only decomposition approach, it can use parallel where alternative routes can be followed. Advantages of this is that the problem can be laid out before any effort is expended on the finer details of the algorithm development. Structured programming: In structured programming, functions or procedures were ‘packaged off’ to perform a more limited range of jobs. This improved the layout and how easy it was to read. The constructs on which programming is based are: o Sequence- executing one statement or sub-program one at a time. o Selection- branching to a different place in the program due to a Boolean value. o Iteration- repeating a section of code until Boolean is true. Object-orientated programming: “A program made up of objects (custom-made data structures to represent often-used realworld entities) that interact.” Includes Java and C++. Algorithms An integral part of the decomposition process. Small problems, from bigger ones, should be solvable using an algorithm. Recursive algorithms are useful for solving repetitive but simple problems, they may have any number of iterations. Algorithms do not work on their own, they are designed to do something with something else. Summary: Computer scientists have used decomposition to solve problems for a long time. There are many developed ways of decomposition. We can use this key concept in real life, everyday problems. Tasks Consider the advantages of each level of detail given in this example. When would you use each? Example: A friend is travelling to visit you at your home. You need to explain how to get there. Consider the following approaches: 1. Get the train to Central Station, then get a taxi to 24 Acacia Avenue. 2. Get the train to Central Station, then get the number 23 bus. Get off the bus after six stops, walk down Back Street, take the second right into Acacia Avenue. Number 24 is 100 metres along on the right. The first is less detailed but is easier to follow, it could be used for someone who is not good at following instructions and if they have a taxi driver who knows where to go. If it goes wrong there is less to fall back on however it is less likely to go wrong. The second is more detailed but more complex. It could be used for someone who is good at following directions. It is more likely to go wrong but it is easier to go back a step. A decimal number such as 21 can be decomposed into its separate digits; that is, 2 × 101 + 1 ×100. 1. Decompose the binary number 1000001. 128+0+0+0+0+0+0+1=129 2. Decompose the decimal equivalent of binary 1000001. 1X102 + 2X101 + 9X100 3. Decompose the hexadecimal decimal equivalent of binary 1000001. 81 What is the end condition in the binary search implementation given on this page? Else return mid Define the term ‘recursion’. A means of applying a solution repetitiously. GNU is an operating system. Explain why the name GNU is recursive. Because the solution must be applied, for separate things, many times. A library accepts new members and stores data about them. It issues them with a card. It also updates membership details when necessary. When the member leaves, the record for that member is deleted. Express this library system as a data-flow diagram. Welcome New member Enter data Current member, new details Update details Store data Issue card End Member leaving Delete data