Pīkau 8: What is programming?

arrow_downward

Introduction

Why this matters

Programming, and the products of programming, have become entrenched into our everyday lives in many ways. Let’s explore how we can take more control over it.


Download the transcript for this video.

The big picture of programming

You don’t have to be a computer scientist to be able to use a programming language. Here we will explore Scratch, a widely used programming language for teaching students from senior primary to junior high school, although many other ages as well. We’ve shown it a bit in previous pīkau, but this is a more in-depth look at it. If this is your first time with Scratch you may be pleasantly surprised at how easy it is to use and how much fun you can have with it. We’re not going to try to teach you all about programming here - the main goal of this pīkau is to show you the bigger picture of what programming is about, and in later pīkau we’ll look more in depth at the elements we’re using here.

This video is 17 minutes long. We recommend having a go with Scratch yourself while you watch it. You will need two screens to do this.If you don’t have two screens yourself perhaps you could watch it with a colleague and share two laptops.

Go to Scratch, click on “Try it out”, and you’ll be in a similar environment to the one in the video (it’s free, and no need to install the software).

Download the transcript for this video.

Skills involved in writing a program

Now that we’ve looked at how a program is written and tested, we can think about what the skills are that are involved in writing a program. This video explores how the skills involve a lot more than just “coding” - in fact, writing programs relates strongly to the key competencies in the New Zealand curriculum (Thinking, Relating to others, Using language, symbols and texts, Managing self and Participating and contributing).

Download the transcript for this video.

Activity: Playing with programs

You can easily experiment with the programs in the previous video by clicking on the following links. Remember that you can’t do any damage - if things get too messed up, just click on the link again and start over! And note that at this stage we haven’t really taught you much about how to program, so don’t worry too much if it doesn’t work - at this stage we just want you to see that you can easily access programs.

If you’re completely new to the Scratch language, there’s a tutorial and help interface at the following link to get a feel for the basics.

Scratch: getting started tutorial

To try a program, click on one of the following links, and then click the “Show inside” then “Remix” button. You’ll be editing your own copy of the program. Here are some ideas for things to try,:

  • Open the simple four-number program, and change it to translate to another language by changing the “say” commands. Of course, test that this works.
  • Open the simple four-number program, and add an “if” statement to translate the number 5 (rima). The “if” statement is in the “Control” list. Of course, test that this works. If you’re keen, you could add ono (6), whitu (7), waru (8), and iwa (9).
  • Open the program that translates numbers from 1 to 19. Can you find any bugs in it? For ideas, what happens if you give it a number outside that range? What about numbers close to 10? Can you change it so that it translates the number 0 (which is “kore”)?
  • If you’re experienced with programming, consider extending the previous program to work with 20 (rua tekau), and up. As a hint, it will be a lot easier if you have a list of the words for the numbers from 1 to 10, and/or a function to display a number from 1 to 10. A program like this uses the elements expected at NCEA level 1.

The Six Elements of Computer Programming

So what makes a computer a computer? Isn’t it always changing? Let’s find out how the basics have been the same for decades!

Download the transcript for this video.

What's the best programming language?

Is there any point in teaching a particular language if there are so many different programming languages? Yes! Here we will show why.

 

Download the transcript for this video.

By the way, in case you really want to know what languages are used in industry currently, there are several surveys available, although they use a variety of criteria, so don’t expect consistent results!

Remember being used in industry isn’t the main reason for choosing a particular programming language, but it is good to know what the trends in industry are, and more importantly, to see that there’s a large variety of languages that professionals use.

All the more reason to focus on teaching principles, and not worry if the particular language will get students a job!

Programming in another language

The following video explores what the number conversion program shown in the Playing with Programs activity a few pages back would look like if written in a different programming language (Python).

Download the transcript for this video.

The program that Tim wrote in the above video is available from at repl.it:

Tim's simple Python program

A longer version of the program that will display numbers up to 19 is also available:

Tim's more complex Python program

(Note that there are other ways to write these programs that are more flexible, but they have been written to be easy to follow).

Even the short Python program contains all six elements of programming:

  • sequence (from top to bottom)
  • selection (the “if” command)
  • iteration (the “while” command)
  • input (the “input” command)
  • output (the “print” command)
  • storage (storing the number in the variable called “number_to_convert”).

Programming and the NZC

The key skills to be successful at programming are from the front end (key competencies) of the New Zealand Curriculum: Thinking, Relating to others, Using language, symbols and texts, Managing self, and Participating and contributing.
These skills also connect to problem solving and iterative processes in the Technology learning area.

Link to the New Zealand Curriculum and programme design

This pikau has been a general overview of programming, and your programme of teaching will need to relate to the appropriate Progress Outcomes for the level of your students. The Progress Outcomes gradually scaffold students through the key ideas in programming.

The concepts covered in this series of pīkau (EMP04 to EMP10) go through to year 10, so for many teachers this is simply showing that big picture of what you are preparing students for.

The six general elements of a “complete” programming language appear in the Computational Thinking progress outcomes using the following terminology. The first Progress outcome in which they appear is given, although some concepts may be useful to introduce earlier to support particular types of programs that students want to develop.

  • Sequence: starts in Computational thinking for digital technologies (CTDT), Progress outcome 1
  • Output: starts in starts in CTDT, Progress outcome 2
  • Input: starts in CTDT, Progress outcome 3
  • Iteration: starts in CTDT, Progress outcome 3
  • Selection: starts in starts in CTDT, Progress outcome 4
  • Variables (Storage): starts in starts in CTDT, Progress outcome 5.

The following general techniques and ideas appear at all levels, and students can develop more rigour in each one as they gain experience:

  • Decomposition: breaking a large programming or debugging task into small, manageable components
  • Algorithms: the general idea of how the program will work, which is then coded for the specific programming language being used
  • Testing: rigorously trying to identify if there are bugs in the program, either in terms of doing what it should do, and also if it does what the user needs it to do and is easy to use
  • Debugging: tracking down bugs and fixing them.

Wrapping up and where to next

Computational Thinking, and programming in particular, is a set of skills that need time-on-task. It’s a bit like learning to be good at sports - if you play the game a lot, you’ll get better, but there is also work to be done off the field, such as weight training, team building, and learning good strategies. Likewise, a good musician doesn’t just prepare for concerts; they spend time developing skills by playing scales and arpeggios, listening to others performing, and doing many other indirectly related activities. With any subject, if you’re motivated then you might not even notice all the time you spend on the task.

You can find books and courses that claim to teach programming in 7 days - or 24 hours - or even one hour! But this is like teaching piano playing or a sport or reading in one hour - you can achieve something gratifying, but we know that a student will need hundreds of hours practising the skill, and thousands of hours if they want to do it professionally. The good news is that sports coaches and music teachers hope that their students will surpass them, and it’s the same with programming. You’ll be able to develop enough skill to teach programming in a relatively short time, and you’ll also find yourself learning as you teach, but don’t be daunted that there’s always more to learn - every field is like that. Teachers who are new to these ideas generally report that the first year or so can be a bit of a challenge as they get to grips with new concepts, so don’t worry if it doesn’t all fall into place for you straight away! After a couple of years it will start to become familiar, and even natural.

In this Pīkau we’ve focussed on programming, but of course, Computational Thinking involves more than just this.

Programming is a fundamental tool for computational thinking, but reducing computational thinking to “coding” is like reducing music to “pressing the notes on a piano”, or reducing soccer to “kicking a ball”. It’s an essential and empowering skill, but not the only thing needed to understand and create digital innovations.

Further reading

There is a more extensive seminar by Tim Bell about “coding and programming” available here:

Digital Technologies Hub: Coding and programming with Tim Bell