Tao of Computational Thinking in Programming

iconpy200.png

This Course for Teachers of KS2/KS3 pupils is undergoing revision and radical rewriting. You can copy this revision of the course as it is now, by viewing it in Google Chrome browser, with a right click, saving it as an html file to be viewed as a local file in your browser. Or download a PDF version in repository-2. It’s a work in progress. Your comments and suggestions are welcome.
If you want skip the Rationale, Overview, Pedagogy… and dive straight in go with:

Let’s Go — Practical Sessions for Teachers — Project 1: The Aqado Board

Latest Update: 14th April 2017.

Contents

  1. Rationale
  2. Overview — Teaching at the KS2/KS3 Interface for beginners in Python 3
  3. Pedagogy for beginners in Computational Thinking and Python 3
  4. Problem Domain: Grid of Squares in the 2-D plane
  5. Project 1: Drawing the Board for Aqado
  6. Programming Toolbox
  7. Programming Paradigm
  8. A Basic Model of Computational Thinking
  9. Let’s Go — Practical Sessions for Teachers — Project 1: The Aqado Board
  10. Let’s Go — Practical Sessions for Teachers — Project 2: Colouring the Background on the Grid with ISPY

Rationale

Our core approach is project-based,  problem-solving oriented and encourages creativity and computational thinking.
In this introductory part of the course we discuss with teachers a strategy of how to teach computational thinking and programming to pupils in the KS2/KS3 band, based on action research findings and classroom experience.
We assume in our approach that the pupils are new to text-based languages like Python. Our aim is to teach computational thinking in problem solving with unplugged programming on the way to learning Scratch 2.0 and/or Python 3 and we scaffold the learning of with the aid of  push-button ISPY, and later with Push-Python.

Using Unplugged Programming, Scratch 2.0 and Python 3

However, pupils who are already engaged with programming in Scratch can develop their computational thinking by undertaking the problems in the problem domain, while practising their use of sequence, repetition and functions in their Scratch.  Similarly, with learners of Python 3. If you want a more interactive hands-on programming process with instant incremental response, use ISPY and later Push-Python. Pupils who are conversant with Scratch 2.0 can undertake the projects with Scratch as their programming language and use ISPY and Push-Python as a transition vehicle to scaffold their introduction to Python 3 when the time is right. Our general approach can be summarised as:

  1. Develop an ongoing pedagogy in computing (ispython.com/pedagogy) guided by: a project-based problem-solving approach, current research findings, classroom experience, existing expertise in other disciplines. And  we look to take part in further action-research in the classroom.
  2. Select a cross-curricula problem domain, interesting and responsive, fun for pupils to explore, and fertile in problems to solve
  3. Examples.  Choose a do-able  project to undertake. Use graded and related example problems (decomposition) first for practice, and so build confidence before taking on the project.
  4. Choose a basic appropriate programming toolbox in which to design and create user-tools for problem solving in this domain.
  5. Implement the simple, but general, paradigm for problem solving in computing:                                                                  program(toolbox + user-created tools) = solutions
  6. Harness computational thinking in problem-solving to achieve a human solution in pursuit of a program solution.

Overview: Teaching at the KS2/KS3 Interface for beginners in Scratch 2.0 and/orPython 3

Here our strategy is to recognise that we are embarking on a path to teach beginners computational thinking in programming. The pedagogy we employ, choice of problem domain, examples, programming toolbox, programming paradigm and computational thinking are geared to delivering the start of a pathway, which is suitable for teaching beginners in the KS2/KS3 spectrum.

1. Pedagogy for beginners in Computational Thinking and Python 3

Our pedagogy, which we try to make explicit in the process of delivery for teachers, for this project includes:

  • Investigating human solutions with pencil and paper
  • Unplugged programming: human robot ‘Walking the Talk’ solutions
  • Enquiry-led learning
  • Read code before you write code
  • Opportunities for experimenting and learning by doing
  • Guidance in graded problems to promote computational thinking in programming
  • Looking at different solutions (generalising and evaluating)
  • Transferring our drawing/walking solutions and our robot to the screen with
  1.  ISPY (red arrow) – push-button, instant response, scaffolded programming for beginners
  2. Scratch 2.0 (sprite)
  3. Python 3 (turtle)
  • Inhabiting  a drawing  environment,  in which the project and related problems have an ongoing graphical response with which to gauge progress. (The response is instant when using ISPY and Push-Python.)
  • Selecting a project and adopting a problem-solving approach to learning computational thinking and programming
  • Investigating human solutions with pencil and paper
  • Unplugged programming:  with the ‘human’ robot ‘Walking the Talk’  programming solutions
  • Practising with simpler but  related problems
  • Enquiry-led learning
  • Reading  code before you write code (on ISPY)
  • Opportunities for experimenting, using and creating tools, and learning by doing
  • Guidance in graded problems to promote computational thinking in programming
  • Looking at different solutions (generalising and evaluating)
  • Transferring our drawing/walking solutions, and our robot solutions,  for further development to the screen with

2. Problem Domain: Grid of Squares in the 2-D plane

 Figure Flying red-arrow on a square grid: symmetry and repetition in the drawing --- reflected in the code. What is the code for this staircase?

Figure 3. Flying red-arrow on a square grid: symmetry and repetition in the drawing — reflected in the code.

We have chosen a 2-D rectilinear grid as our first problem domain. The advantages of this and the  2-D open plane as a follow-up domain are:

  • that the developing programming produces an immediate response, whether that is:
    • Drawing on paper
    • “Walking the talk” — motion with a ‘human’ robot
    • Flying red-arrow using ISPY on screen. See Figure 3 and Session 4).
  • There is a direct correlation between the three positional movements: forward, left turn and right turn of the unplugged human robot, the activities listed above, and the motions of the Scratch sprite and the Python turtle, all of which inform the transition from KS2 to KS3, unplugged to block-based to text-based programming.
  • Consequently, you can move to ISPY, Scratch 2.0, Python 3 now, or at any point in this Course. We think there is much to be gained by first focussing on and gaining competence in the computational thinking in human problem solving by devising an ‘unplugged’ program of drawing/walking the robot, and/or an ‘unplugged’ program to move the red arrow in ISPY by pushing buttons. The pupils’ ‘unplugged’ programs, which will employ the basic ‘motion’ instructions of a robot/sprite/turtle and the programming concepts of sequence, repetition and functions are straightforwardly mapped into Scratch 2.0 and Python 3. The additional challenge of the learning in detail required to familiarise pupils with a block-based or text-based programming environment can then be undertaken to implement the ‘unplugged’ program solutions in Scratch/Python. An introduction to Scratch 2.0 geared to this course can be downloaded from repository-2.
  • Symmetry and pattern in drawings can be used in computational thinking to link the corresponding symmetry and pattern in the code and vice-versa, via the programming control structures of sequence, repetition and functions.
  • Using the instructions: fd1, lt, rt what is the code for this staircase?
    [Answer:
    fd1 lt fd1 rt
    fd1 lt fd1 rt
    fd1 lt fd1 rt
     …………… UPL(1)
  • but see Session 3… “Introducing Repetition…”  for more concrete discussion]

3. Project 1: Drawing the Board for the Game Aqado

The board for the game Aquado. AQA GCSE controlled assessment 2015

Figure 4. The board for the game Aquado. (AQA GCSE controlled assessment 2015)

The specific project we start with: build a program to draw the Aqado game board in Figure 4. Aqado is a counter game played with a dice to be hosted on a computer(part of an AQA GCSE 2015 controlled assessment assignment).

The project could, of course, be to draw any one of a number of grid board games, including noughts and crosses 3×3, boggle 4×4, 5×5, draughts 8×8, sudoku 9×9, snakes and ladders 10×10, crosswords 13×13, …

In order to pave the way to complete Project 1, we engage with a number of simpler related problems.(Decomposition).

4. Programming Toolbox

Figure 5.

The 3 basic motion instructions for line drawing in Figure 5, with Seymour Papert’s turtle (in Python) or the Scratch sprite, together with 3 programming control structures: sequence, repetition and functions make up our starting programming toolbox. Useful tools for drawing are created from the basic toolbox to solve specific problems and added as new instructions to our toolbox.

5. Programming Paradigm

Implement the simple, but general, paradigm for problem solving in computing:
programmming(toolbox + user-created tools) = solutions.
We add user-designed tools to the toolbox, by defining equivalent code functions derived from the component instructions in the basic toolbox. The objective is for pupils to learn how to use user-designed tools and then to design their own simple tools; and adopt this programming paradigm for more effective problem solving.

6. Model of Computational Thinking

Our approach encourages creativity through symmetry and pattern matching.

  • Algorithmic Thinking – thinking through the strategy and steps required to solve a problem(AT)
  • Decomposition – breaking a problem down into its smaller components(D)
  • Abstraction – reducing and hiding complexity by using or creating tools/models
  • Generalization — adapting solutions so that they can be used to solve a wider range of problems(G)
  • Evaluation – assessing whether a program or technique works correctly, efficiently and by other criteria e.g. maintains good programming practice.(E)

Let’s Go: Practical Sessions for Teachers — Project 1: The Aqado Board

In this example, we give instructions for the class (preceded by  •) and add comment (in italics) to make explicit  some of the computational thinking and pedagogy that underpins the sessions.

Session 1: Computational Thinking for a Human Solution

Figure 6. Figure 6 .

We are going to look at solutions to a simpler problem than the Aqado board. (Decomposition: we simplify the problem, by choosing a model that picks out the bare essentials of the line drawing: a basic 3×3 grid of squares — hiding a lot of the detail and structure of the project. (Abstraction). And our simple model also forms the basis for projects involving any number of different board games.

  • Show the Aqado board and the reduced model in Figure .
  • Give out paper and pencil. Ask each person to draw just the 3×3 grid model.
  • Ask them to describe how they did it — their algorithm for a human solution.  (Algorithmic Thinking)
  • Draw their attention to the symmetry in the 3×3 grid and the components that make up the grid. Ask them to draw the 3×3 grid again ‘systematically’, to bear in mind that they might want to draw a 4×4 or a 10×10 grid later on…(Generalisation)
  • In small groups, ask them to discuss and come up with 3 or 4 really different ways to draw the 3×3 grid. There are at least a dozen different ways…
  • If necessary, give them a hint: What do you see in the model as potential building blocks/templates to repeat in order to draw the model ‘systematically’. [ lines, squares and rectangles…]
  • Ask them to choose one solution they can use to build a program which seems easiest — perhaps easiest to generalise. (Evaluation)

Our ‘Unplugged’ Programming Tool box:

  • Describe ‘Walking the Talk’ with the 3 instructions, in UPL (unplugged programming language): forward, left turn, and right turn to drive the robot. These instructions are common to Scratch, Python, (and other languages which implement the sprite/turtle). Together with the universal programming control structures of sequence, repetition and functions. The toolbox can be expanded (later) by introducing user-defined functions/instructions representing building blocks e.g. squares, lines, or rectangles.
  • Find out if everybody knows what characterises a robot/sprite/turtle/ in the plane when we want it to move? (Enquiry-led learning). [Answer: position, direction]
  • Ask everybody (who agrees to) to stand up and be a robot.
  • Describe how at the start, a robot faces to the right as the handler views them, and chooses enough space in front and to their left to allow at least one pace forward or to the left. (If you think of the floor as a page, on which they leave a trail — a drawing, each robot is standing at the bottom of the page and the top of the page is to their left). See Figure 3.

Repetition and Return Programs

  • Get all the robots moving.See ‘Walking the talk’ and ISPY in action. Give the following commands verbally. (To illustrate the repetition with your voice — pause after each line):
    forward one, left turn
    forward one, left turn
    forward one, left turn
    forward one,
    …………………………UPL(2)
  • Ask them to describe what happened, and what they have drawn.
  • What would be the effect of adding another instruction: left turn in the last line of the example?
Figure 7.

Figure 7 (a),(b)Two programs for a square — one symmetric (b)– a returned program.

The same program in the UPL short code, (and on the push buttons in ISPY) would be:

fd1 lt
fd1 lt
fd1 lt
fd1
………………UPL(3)

We are looking for repetition and symmetry together in the shape drawn, and in the code. The complete code symmetry is finally achieved by adding the lt command on the final line in program UPL(2). An example of a  return  program. (One where the robot returns to the starting position and starting direction).

 

Session 2: Computational Thinking for a Computer Solution

It would be possible now, with our 3 instruction toolbox to instruct the  robot to draw the 3×3 grid.  We could try for a computer solution to mimic a human drawing solution ?

Here is one solution:
1 draw a 3×3 square
2 move the robot to point A facing right
3 draw a 3×1 rectangle
4 move the robot to point B facing up
5 draw a 3×1 rectangle

1 fd3 lt fd3 lt fd3 lt fd3 lt
2 lt fd1 rt
3 fd3 lt fd1 lt   fd3 lt fd1 lt
4 rt fd1 lt fd2 lt
5 fd3 lt fd1 lt   fd3 lt fd1 lt

We could get the computer to mimic the human solution exactly? Or we can try to harness directly the properties and capacities of our toolbox, by experimenting with the instructions and introducing ‘verbally’ our programming toolbox in its ‘unplugged’ format, including the programming control structures sequence, repetition and functions.

 

Or we can try to harness directly the properties and capacities of our toolbox, by experimenting with the instructions and introducing ‘verbally’ our programming toolbox in its ‘unplugged’ format, including the programming control structures sequence, repetition and functions.

Session 3: Functions and User-designed Tools

The instructions left turn (or shortly: lt); right turn: rt are functions. They stand for fairly complex code (machine code) which is hidden (abstraction). (There is no number (argument) attached to these instructions; the turn is through 90 degrees, understood –- this changes later when we move from the grid to an extended problem area: the whole 2-D plane).

The instruction forward, fd is accompanied by an argument, a number, so forward3 or fd3 is move forward 3 paces and draw as you go, — again a function this time with a number (argument) — the number of paces — 3. We will be creating and using tools, user-defined functions, which use arguments just like the  instruction forward  does. For example, a user tool to draw a square with a side length of say,  2 paces we might create as  square2 or shortly sq2, where the two could be replaced by whatever number we choose.

Figure

Figure 8.(a) Drawing capital L
(b) Drawing capital L as a return program

  • Get the participants to inhabit the robot/handler relationship by working in pairs to understand and practise the three moves. For example, by drawing a capital letter from an easy-to-draw  set: ‘L’, ‘I’, ‘F’, ‘T’, ‘E’, ‘P’ or other shapes: rectangles, squares, ‘+’, ‘9’…
    The code for capital L, with the robot starting from bottom left and facing right, could be:
    forward one, left turn, left turn
    forward one, right turn, forward two
    ……..UPL(4)
    The return program in Figure (b) is achieved by adding the instructions
    left turn, left turn, forward two, left turn
    to the end of the previous code (A return program is one which finishes with the robot, sprite or turtle finishing at the starting point and pointing in the starting direction)
  • Draw a rectangle using a return program. Thus illustrating how the symmetry of the drawing is reflected in the code
Figure . A 3x1 rectangle

Figure 9. A 3×1 rectangle

[Ans: The code for a 3×1 rectangle could be:
forward three, left turn, forward one, left turn
forward three, left turn, forward one, left turn
……..UPL(5)
or in the short code version:

fd3 lt fd1 lt
fd3 lt fd1 lt
……..UPL(6)]

When there is a repeat symmetry in the code it is useful to pick this out by lining the code up with repeats on consecutive lines, see UPL (1),(2),(3),(5),(6) — in preparation for using the repetition structure in the programming language.The return program often helps to complete symmetry in the code, but it is also an important concept when later we want to create patterns.

Introducing Repetition and Functions with the ‘Human’ Robot

to be continued…

Session 4: Moving to the Screen with ISPY/Push-Python

to be continued…(we intend an improved beta version of the software for ISPY to be available for download for free courses at UCL for teachers for Summer term 2017)

Figure . ISPY -- Toolbox1 Picking up the symmetry in the rectangle 3x1 using a repeat instruction

Figure . ISPY — Toolbox1
Picking up the symmetry in the rectangle 3×1 using a repeat instruction

Let’s Go — Practical Sessions for Teachers — Project 2: “Reach for the Stars” Regular polygons and Stars with ISPY

to be continued…

Leave a Reply