CS21 : Algorithm development

In this section, we look at the big picture of programming. Tying together all the work we have done so far on programming and looking also towards more advanced topics that we have yet to meet.

We are learning ...
  • To recognise each part of the big programming picture
  • About standard programming concepts
  • How to draw flowcharts and represent algorithms in other ways
  • About professional code structure
  • How to check that your algorithm is running correctly.
  • How to become a good programmer!
So that we can ...
  • Consider each part of the 'big picture' when we are preparing to code
  • Use the standard coding constructs with confidence
  • Communicate algorithms to other people / programmers
  • Code in a professional and clear manner
  • Be confident that any algorithm we develop will run correctly.
  • Become a good programmer!

Activity 1 The BIG picture! 

Here is a really big picture ...

Click to view (cause it's really big)

The image shows most of the software development tools which you will use during your time as a fledgling computer programmer. You will see some of the things we've learnt about before plus some new stuff.

Task 1.1
A3 copy of the Big Picture (Your teacher will provide one)

Spend 10 minutes, silently reviewing / reading / watching this diagram. You should use Red, Orange and Green highlighter pens to 'RAG' the diagram to give you some areas which you will need to find out more about.

Now use the textbook to research your RED areas. Work in groups if you wish - it will help to discuss the concepts laid out here. DO NOT use the computers to do this. Use the textbook.

OUTCOME : Considerably highlighted picture plus a list of areas which are green, a list which is orange and a list which is red (these are the really important ones for you to focus on!)

Activity 2 Standard programming concepts

There are certain, basic programming concepts that you must be familiar with at this point (if you aren't, I'm really surprised you've made it this far) ...

Note that these are general constructs - they may NOT be 
available or look like this in the programming language 
you have been learning ...

In terms of modelling skills which you may have experienced at this stage, and definitely in a particular order ...

Click to view

Task 2.1
 Push your limits

For each of the standard programming concepts and the modelling skills listed above, try to find or develop at least one example for each one. However, don't push yourself beyond your previous experience - if you don't recognise a concept DO NOT research it.

It's interesting to see where you are now so that you can plan where you are going to go next.

OUTCOME : Practical examples of the skills you know now plus an appreciation of the journey you are on.

Activity 3 What is an algorithm?

Our friend Google defines the term algorithm as ...

Click to view

A good algorithm must exhibit the following characteristics :
  1. A particular set of input values must produce the same output each time the algorithm is run;
  2. The answer for any particular input must be correct;
  3. The algorithm must stop after a finite number of steps;
Without these qualities, an algorithm simply will not do.

Task 3.1
 Researching algorithms
Web browser

You have probably seen an algorithm for the FizzBuzz game, or even played this in maths.

Click to view

Play this game with a friend and when you are satisfied that you understand how it works, research 5 programmed solutions using the Rosetta Code website. For each programmed solution, you should try to identify how each part of the programmed solution relates to the algorithm itself.

OUTCOME : 5 different programmed solutions to FizzBuzz plus an analysis of each program to identify how it represents each part of the algorithm. You should present your analysis in an inventive way.

Question we must ask at this stage are ...

Activity 4 Communicating algorithms

There are three common ways to communicate algorithms ...
  • Structured English
  • Pseudocode
  • Flowcharts

Task 4.1
 Structured English and Pseudocode
Structured English, Pseudocode and Pascal.docx

Download and print the handout from the lesson resources. Look carefully at the differences and relationships between the Structured English, Pseudocode and finally the Pascal solution (which is a really old language but it looks like Pseudocode).

Answer the questions in your notebooks.

OUTCOME : Questions answered in your notebooks, correctly.

Flowcharts are a visual way of representing algorithms. You've met them before, so there is little point in teaching you how to suck eggs, however ...

Task 4.2
 Flowchart exercises
Web browser

Visit the following website, read the introduction and attempt the exercises. Try to work quietly and independently until you get all the correct answers!

OUTCOME : Satisfaction!

There is a great piece of software that you can use if you wish to experiment with flowcharting in more depth ...

Click to visit the Raptor Homepage

Activity 5 Coding style

When developing coded solutions to problems, it's all about style!

Click to enlarge

Task 5.1
 To Do List
Some vague awareness of you skill level

Like you did at the beginning, carry out an audit of your individual skill level. You should use the table above to create a to-do list of the skills which you have and desire.

OUTCOME : To-do list

Activity 6 AFK!

Before you even begin to program a solution to a problem, it's a good idea to check that you algorithm actually works correctly. This is always done away from the computer and is known as Desk Checking, or sometimes Dry Running. In the process of checking the correctness of the algorithm, it is common to construct a Trace Table.

Extension Activities 

How about these?
  • Download and complete the 'What's the question' activity from the lesson resources.

  • There is a PDF file in the resources which outlines a real algorithm for making the perfect cup of tea. Read this and be amazed that people take tea comparison that seriously!

  • There is a zip file in the lesson resources which contains lots of Raptor tutorials and example flowcharts. Work through these and see how far you get.

What's next?

Before you hand your book in for checking, make sure you have completed all the work required and that your book is tidy and organised. Your book will be checked to make sure it is complete and you will be given a spicy grade for effort.