Topic outline

  • General

    Structured programming in Scratch :


  • Topic 1

    Mythbuster Jr Wisdom

    You learn more from  failure than instant success. Failure is always an option.

    You are more likely to succeed if you can work effectively in a group.

    Don't let anyone tell you you are to young to tinker or code.

    You are always allowed to try this at home.

    • Topic 2

      Context : the Mars Sojourner

      NASA's first robot to explore the surface of Mars was called "Sojourner". The name Sojourner was selected because it means "traveler."

      A  visual programming language used by NASA called LabVIEW that was developed by the Tufts CEEO, to program Sojourn's progress around the Red Planet. This meant that as modules (procedures of code) were developed, the language could be attached to icons that could be quickly joined together to produce code.

      This meant that large programs could be produced already tested and ready to go.

      LabView code

      Later, this process was applied to many languages such as Scratch and Makecode.

      A computer programming language is defined by three structures

      • sequence
      • decision
      • iteration

      we will investigate these as we progress.

      Code is made more flexible with the addition of

      • variables
      • user defined functions
      • built in functions
      • lists

      we will meet these along the way

      • Topic 3

        Keeping track of what you have done

        As you set out on you journey into Computer Science, there are some things to do to start. It is wise to keep a record of where you are going and where you have been. This is so you can refer to to what you have done, reminding yourself of problems you have solved and their solutions and have evidence of you ability to code not only for assessment, but also in applications for scholarships and employment.

        First, be sure you have a relevant text book or guiding website that can help you in your journey. there are plenty of help out in cyber space.

        Keep your laptop in a cover. That means you can carry a notebook and pencil. When writing algorithms of working on code, a scribble pad is necessary. Also, when code fails to execute, you can go back to see where your problem is.

        Know how to do a formal write up using Title, Aim, Method, Results, Conclusion and be able to record this using a word processor.

        Have a web site such as Google Drive where you can save your write up and Code. Organise a separate directory (folder), name it appropriately including a date, and have sub directories for reports and code.

        Where possible, have the Scratch application loaded locally onto machine. This allows you to work offline, and it  is more efficient.

        • Topic 4


          A sequence is when a programmer puts a series of commands that run one after another
          • Topic 5

            Repetition #1

            • Topic 6

              Introducing variables

              Creating a variable

              A variable is a token that is assigned a value. This value can change in a program using the assignment operator

              eg variable = 0

              variable = 1

              Clearly, when using a variable as a counter 

              eg variable = variable + 1

              to say variable equals variable + 1 is clearly absurd. But the computer just adds one to the variable and stores this value in it's memory location. 

              The assignment operator should not be read as "equals" but "becomes" or "assigned to".

              ie variable becomes 0


              the value of 0 is stored in the token of 1

              • Topic 7

                Making a plan (algorithms)

                The word algorithm comes from the name of the 9th century Persian and Muslim mathematician Abu Abdullah Muhammad ibn Musa Al-Khwarizmi (Latinized Algoritmi), he was mathematician, astronomer and geographer during the Abbasid Caliphate, a scholar in the House of Wisdom in Baghdad.

                He is often considered one of the fathers of algebra.

                Also the creator of the numbers which we use today.

                The word means "step wise" and means the number of step needed to solve a problem. In the broader sense, Algorithms are written every day to guide others into solving problems.

                eg car manuals, computer books, policy documents. All algorithms.

                In coding, a program that uses the least number of steps in a solution is considered to be "elegant". 

              • Topic 8

                Manipulating variables

                Pupils at school enter the Science Teachers (STAWA) solar challenge. They race solar cars down a track powered only by a solar panel.

                To maximize the solar energy, we can determine the angle of the sun in the sky . This is done using a shadow stick. Measure the length the stick and its shadow and use trigonometry (atan function) to determine the angle.

                A function is a peice of code that takes in one or more inputs and delivers one result.

                This function designed to

                • take in two inputs,
                • assign them to variable names
                • manipulate them into a meaningful format
                • then run a built in function to determine information.

                We can then use geometry to set the solar panel on a solar car to get the optimum sunlight.

                • Topic 9



                  You can break your code up into sub procedures Scratch calls blocks. You can then call these sub procedures from anywhere in your code. 

                  The main program is called the driver routine.

                  • Topic 10

                    Entering data from keypad using a variable

                    The program you wite becomes a lot more flexible and interactive if you can prompt for data input from the user.

                    There is a whole topic on making sure the data is the correct format, but that is not in the scope of this course.

                    • Topic 11

                      Structure chart

                      A serious coder plans their  programs using a structure chart. A very simple plan might be 

                      • Splash page : the title of the code and maybe what is does
                      • A block that calls for data input
                      • A block that does the work
                      • A block that tells you the answer

                      This means you can work on each part of the program in isolation.

                      • Topic 12


                        list (called an array in other programming languages) is a tool that can be used to store multiple pieces of information at once. 

                        They are in the form

                        x(1) = All Star
                        x(2) = Hey Ya!
                        x(3) = Hey Ya!
                        x(4) = All Star
                        x(5) = Hey Ya!
                        x(6) = All Star

                        Each entry is called an element. 

                        example list

                        Create a list

                        Just go to data and create a list.

                        Opposite are the tings you can do to manipulate the elements in the list.

                        Lists and arrays are used frequently in storing data. They are a powerful way of creating databases and manipulating data into information.

                        The data is sorted, searched, ranked, calculated and graphed, to name a few. It is the way the NSA in America keeps electronic tabs on you.

                        list blocks

                        A fun example

                        As a way of exploring sentence construction, folks came up with this kind of game. 

                        The following is a random sentence generator. It contains personal pronouns, adjectives and nouns. 

                        You can store them in lists, then use random numbers to generate your own sentences.


                        Non smarty pants kids may be tempted to create sentences that they think funny but might offend others.


                        cat 2

                        cat code

                        Vocabulary : 

                        List, array, element, data, information, data base, 

                        • Topic 13

                          Simple recursion

                          • Topic 14

                            Recursive spirals

                            • Topic 15

                              Recursion : putting the first six Fibonacci numbers in a list.

                              Fibonacci c.?1170 – c.?1240–50)[6] was an Italian mathematician from the Republic of Pisa, considered to be "the most talented Western mathematician of the Middle Ages".[7]

                              The name he is commonly called, Fibonacci, was made up in 1838 by the Franco-Italian historian Guillaume Libri[8] and is short for filius Bonacci ("son of Bonacci").[9][b] He is also known as Leonardo Bonacci, Leonardo of Pisa, or Leonardo Bigollo Pisano ("Leonardo the Traveller from Pisa")

                              He invented his number sequence after breeding rabbits.

                              • Topic 16


                                • Topic 17

                                  • Topic 18


                                    • Topic 19

                                      • Topic 20

                                        • Topic 21

                                          • Topic 22

                                            A Makerspace in Action