Approaches to Software Design and Development

advertisement
NATIONAL QUALIFICATIONS CURRICULUM SUPPORT
Computing Science
Approaches to Software Design
and Development
[NATIONAL 5]
This advice and guidance has been produced to support the profession with the delivery of
courses which are either new or which have aspects of significant change within the new
national qualifications (NQ) framework.
The advice and guidance provides suggestions on approaches to learning and teaching.
Practitioners are encouraged to draw on the materials for their own part of their continuing
professional development in introducing new national qualifications in ways that match the
needs of learners.
Practitioners should also refer to the course and unit specifications and support notes which
have been issued by the Scottish Qualifications Authority.
http://www.sqa.org.uk/sqa/34714.html
Acknowledgement
The publisher gratefully acknowledges permission to use the following sources:
screenshots of own game developed in Scratch programming environment, ‘Scratch
is developed by the Lifelong Kindergarten Group at the MIT Media Lab. See
http://scratch.mit.edu; screenshots of own program developed in Small Basic
programming environment, used with permission from Microsoft.
© Crown copyright 2012. You may re-use this information (excluding logos) free of
charge in any format or medium, under the terms of the Open Government Licence.
To view this licence, visit http://www.nationalarchives.gov.uk/doc/open government-licence/ or e-mail: psi@nationalarchives.gsi.gov.uk.
Where we have identified any third party copyright information you will need to
obtain permission from the copyright holders concerned.
Any enquiries regarding this document/publication should be sent to us at
enquiries@educationscotland.gov.uk.
This document is also available from our website at www.educationscotland.gov.uk.
2
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NAT 5, COMPUTING SCIENCE)
© Crown copyright 2012
Contents
Introduction
5
Approaches to teaching software development
5
Software development with Scratch
6
Scratch environment
7
Example game – Asteroid Invaders
7
Developing computational thinking
11
Programming community
11
Exemplar learning approaches
12
Possible limitations of Scratch
12
Software development with Small Basic
13
Small Basic support and resources
14
Mobile phone example
14
Possible limitations of Small Basic
24
Next steps
24
Appendices
Appendix
Appendix
Appendix
Appendix
Appendix
Appendix
Appendix
1:
2:
3:
4:
5:
6:
7:
Computational thinking
List of scripts created for Asteroid Invaders
Developing computational thinking with Scratch
Linking Scratch to the National 5 outcomes
Developing computational thinking with Small Basic
Linking Small Basic to the National 5 outcomes.
Example Small Basic solution for mobile phone problem
25
27
28
32
35
38
40
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NAT 5, COMPUTING SCIENCE)
3
© Crown copyright 2012
CONTENTS
Appendix 8: Mobile phone solution graduated from Small Basic to Visual
Basic
43
Appendix 9: Table of hyperlinks and downloads used in this document 47
4
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NAT 5, COMPUTING SCIENCE)
© Crown copyright 2012
ADVICE AND GUIDANCE FOR PRACTITIONERS
Introduction
This advice and guidance for practitioners aims to support the delivery of
National 5 Computing Science. At National 5 level, learners should have the
opportunity to gain experience in one or more programming environments.
This advice and guidance provides examples of how Scratch and Small Basic
could be used at National 5 level, but there are many other software
development environments available and practitioners may choose their own
preferred environment. Further examples are provided in the SQA support
materials. Practitioners may have already decided which programming
language to use to teach software development at National 5, therefore these
materials aim to show how the creation of games and programs using Scratch
and Small Basic could be an additional way to support learning in a creative
and challenging environment.
Approaches to teaching software development
Software development has traditionally been
taught in Scottish schools using the waterfall
model. This approach normally expects learners
to design the full program before they begin to
implement their solution. However, an agile
approach may provide opportunities for learners
to express their creativity in problem solving.
Suggested learning approach:
Learners want to create working
programs or games and feel
that they have accomplished
something in class. Allow
learners to create a working
Prototyping model
program or game early on, even
if it is copying or editing an
An agile approach follows similar steps to those
existing program.
in the traditional waterfall model but rather than
plan the full solution in advance, learners would
be expected to analyse the problem and design the main steps of their
program before modelling a solution. A prototyping model could include the
following stages:
Suggested learning approach:
Analysis – Program or game requirements are
defined by the learner in as much detail as they
are able to determine.
Learners could be encouraged
Design – A preliminary design for the new
program is created by the learner. This will
contain the main features of the program.
will show how they developed
Modelling – A prototype is constructed by the
learner. The prototype will contain one feature
progression.
5
to save each increment of their
prototype as a new version. This
their game and provide you
with evidence of their
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NAT 5, COMPUTING SCIENCE)
© Crown copyright 2012
ADVICE AND GUIDANCE FOR PRACTITIONERS
or a number of scaled-down features of the program. This initial prototype is
tested and evaluated, and a second improved prototype is constructed. This
iterative process is repeated until the final prototyp e reflects the desired
program. The final program is thoroughly evaluated and tested , and future
maintenance carried out when required.
By using an agile approach and focusing on creativity and problem solving,
practitioners may help learners to develop their computational thinking.
Computational thinking concepts and practices could be used by learners to
understand and solve problems. Computational thinking is not about thinking
like a computer but rather combining logic with creativity and abstract
thinking to solve problems. A summary of computational concepts, practices
and perspectives can be found in Appendix 1. You can also find a description
of computational thinking on the official Scratch website:
http://scratched.media.mit.edu/sites/default/files/computational%20thinking%
20article.pdf
Software development with Scratch
There is a wealth of Scratch resources and tutorials available to suppo rt
learners in the basics of Scratch on the official Scratch website
(http://scratch.mit.edu/). There is also an area dedicated to practitioners
containing resources and lesson plans (http://scratched.media.mit.edu/). If
practitioners already use Scratch to teach software development to lower
school learners then they may be ideally placed to develop learners’
programming skills using Scratch at National 5 level.
Once the basics of Scratch have been
covered, a good place to begin teaching
learners software development could be to
ask them to make their own version of, or to
take ideas from, an existing game. There are
many examples of classic arcade-style games
available on the web where learners can play
the games and get an idea of the features they
may like to include in their own game.
6
Suggested learning approach: If
you have not used Scratch in
your lessons before now, use
the online tutorials to teach
your learners the basics of
scratch programming.
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
ADVICE AND GUIDANCE FOR PRACTITIONERS
Scratch environment
The Scratch programming environment allows learners to combine colourcoded blocks of code to create scripts. A Scratch program consists of a
collection of scripts. The benefit for learners in using Scratch to learn
programming is that they do not need to memorise code. This allows them to
focus on the logic of their program and to develop their computational
thinking.
Blocks of ready-made code
Sprite scripts
Stage
Sprites
Example game – Asteroid Invaders
In order to help learners develop their software
development skills learners could be asked to
design their own game or create their own version
of an existing game using Scratch. Some learners
may find it difficult to think of their own game
idea, so you may prefer to provide them with a
problem specification that they need to solve.
An example of a learner game could be Asteroid
Invaders, inspired by a combination of Atari’s
Asteroids and Taito’s Space Invaders. In the
following example we will walk through the steps
practitioners could take to help learners break
down the problem specification into manageable
steps.
Suggested teaching approach:
Spend a lesson playing webbased games. Learners could
rate the games on graphics,
gameplay, difficulty, controls,
simplicity, enjoyment etc.
Learners could discuss what
they think makes a simple but
enjoyable game. Learners could
find a game they would like to
copy.
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
7
ADVICE AND GUIDANCE FOR PRACTITIONERS
Problem specification
The aim of the game is to shoot the asteroi ds before they collide with the
gunship. When you shoot an asteroid your score increases by one point and
after one second the asteroid will reappear. The gunship can move left and
right along the bottom of the screen and must avoid the asteroids otherwise
you will lose a life. The game will end when you lose all lives or the time
runs out.
Software development process
The following example shows how a prototyping model could be used to
create a game like Asteroid Invaders.
Analysis
The idea for the game was
developed after playing Asteroids
and Space Invaders online. The
following information was
gathered when playing the games:





the graphics/sprites used
the aim of the game
the controls for the game
the scoring for the game
any timers used in the game.
Suggested teaching approach: Learners could be
advised to concentrate on the main steps they
need to make their game work. Learners could
solve each step in turn. Once they have
completed the main steps they could revisit
them, break them down further and complete
them in an iterative process, adding more detail
and functionality as they go.
Design
You can see an example solution to this problem at
http://scratch.mit.edu/users/N5Scratch. The full list of steps/scripts created
for the game is given in Appendix 2. The final list for the completed game is
very large. To ask learners to design the full solution at the beginning could
make it a daunting task. Learners could build up to a fully working program
by adopting the prototyping model to software development.
The main features modelled initially to create Asteroid Invaders could be:
1.
2.
3.
4.
5.
8
Draw or source the sprites for the game.
Make the gunship move left and right across the bottom of the screen.
Make the gunship shoot vertically.
Make the asteroids move randomly about the screen.
Make the asteroid change costume/disappear when it collides with a
bullet.
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
ADVICE AND GUIDANCE FOR PRACTITIONERS
Practitioners may wish to encourage learners to use pseudocode by asking
them to write pseudocode one script at a time and then to implement and test
it before moving on to the next script. This differs from the approach of the
waterfall model, which would require all scripts to be written in pseudocode
before implementation.
Modelling
Learners could create and repeatedly test
their scripts until they find their desired
results. Once this has been achieved the
learner could move on to perfecting the
next script. Once the main steps have been
completed, they could list more features
they would like to add to their game and
repeat the process. This could continue
until they have completed their game to
the required standard.
Suggested teaching approach: Learners
could sign up for a Scratch account so
that they can upload the games they
have created. Learners could receive
encouragement from other Scratch
programmers and gain confidence from
positive feedback. Their game code
may also help develop other learners’
programming skills across the globe.
Version control
Because of the iterative nature of the modelling stage it may be good practice
for learners to ensure that they correctly identify different versions of their
programs. This could also show practitioners how the program has been
developed. Without overcomplicating the issue, practitioners could encourage
learners to develop their own approach to version control. This could be as
simple as saving their program with a different number at the end of the
filename each time. The following screenshots show the first three versions
of Asteroid Invaders.
Version 1: The first version of the program makes the gunship move to its
starting position in the centre near the bottom of the stage.
Version 1 test run: The gunship moves to its correct starting position.
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
9
ADVICE AND GUIDANCE FOR PRACTITIONERS
Version 2: The second version of the program makes the gunship move left
and right when the left and right arrow keys are pressed.
Version 2 test run: The gunship moves left and right when the respective
arrow key is pressed.
Version 3: The third version of the program makes an asteroid appear and
move randomly about the stage.
Version 3 test run: The asteroid appears and moves randomly about the
stage.
This iterative process could be repeated and saved as different versions until
the full game has been completed.
10
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
ADVICE AND GUIDANCE FOR PRACTITIONERS
Developing computational thinking
At National 5 level learners should have the
Suggested teaching approach:
opportunity to experience programming with
Learners may like to show
one or more programming languages. Using
others their working programs
Scratch to create games could help learners to
and games. Learners could peer
evaluate and help each other
develop their computational thinking and
improve their games and
problem-solving skills. The exemplar table in
programs. Learners could be
Appendix 3 shows how computational thinking
encouraged to work in a team
skills could be developed using Scratch. This
for a class project. They may
also use the Scratch forums and
exemplar table could be used as a basis for
website to allow them to share
learning outcomes and success criteria in
their work with others.
lessons. In addition to developing computational
thinking, Scratch could also help learners to
develop the skills for National 5 Computing Science, as demonstrated in
Appendix 4. Those scripts could be compared with the code used to achieve
the same outcomes in another programming language, eg Small Basic
(Appendix 6).
Programming community
Scratch has a vibrant online learning community
where Scratch programmers can share their
programs. There are also tutorials and forums
available if help is required. Practitioners can
also develop their own community with their
classes. During lessons practitioners could ask
learners to write on a whiteboard any problems
they are having developing their games. Other
learners in the class could then offer their ideas
or assistance to help them finish the script.
Suggested teaching approach:
Learners could be introduced to
programming with Scratch by
being provided with a partially
developed game and asked to
complete it.
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
11
ADVICE AND GUIDANCE FOR PRACTITIONERS
Exemplar learner tasks
The following example tasks could be used to engage learners in Scratch
programming:
Problem specifications
1.
2.
3.
4.
5.
Develop a game with balloons that float about the stage. The player gets
1 point for every balloon they shoot. The player needs to shoot as many
balloons as possible in 30 seconds.
Develop a game where carrots appear randomly on the screen for 1
second. The player must use the arrow keys to control a rabbit that
collects as many carrots as possible in 30 seconds.
Develop a game where the player controls a hungry mouse. The player
must get the mouse to collect a piece of cheese in the corner of the
stage. Starting from the opposite corner and using the arrow keys the
mouse must avoid mousetraps that move randomly across the stage. The
player gets 1 point every time they collect the piece of cheese but loses
all points if they touch a mousetrap. Try
Suggested learning approach:
to collect as much cheese as possible in 30
Learners could add a
seconds.
Make your own version of Space Invaders.
countdown timer to make their
Make your own version of Asteroids.
games more exciting.
Possible limitations of Scratch
Unlike most programming languages
Suggested learning approach:
traditionally used in schools to teach software
Upcoming releases of Scratch
development, Scratch is not well suited to
will allow users to create their
handling text. It may be possible to make
Scratch operate like a command line interface
own blocks. Scratch 2 will also
but options for input and output of text are
allow learners to create and
limited and programming in this way ignores
store programs online or to
the real strengths of the Scratch programming
environment. Combining Scratch with a more
download the program and
traditional type of programming language like
install it locally.
Small Basic will ensure that learners develop
the wide range of programming skills required at N ational 5 level.
12
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
ADVICE AND GUIDANCE FOR PRACTITIONERS
Software development with Small Basic
Small Basic is a programming language that is designed to engage learners by
aiming to make programming easy to understand by creating programs that
are easier to create and fun to learn. It provides tools which help build
solutions quickly and so reduce code input errors.
Small Basic may provide a basis for progression to more complex
programming languages. Programs written in Small Basic can be
automatically ‘graduated’ to Visual Basic, which could help learners in their
progression to Higher Computing and more complex languages.
Small Basic programming environment
Toolbar
Help window: Gives
information about
the commands being
used.
Intellisense window: As you type in the
editor window the intellisense window pops
up and gives you a list of commands that you
can select and use in your program. A
description of the command appears beside
it.
Editor Window: This is where
you enter your program code.
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
13
ADVICE AND GUIDANCE FOR PRACTITIONERS
Small Basic support and resources
Small Basic is free to download from
www.microsoft.com/download/en/details.aspx?id=14246 and
http://smallbasic.com/.
The Small Basic website provides:




Suggested learning approach: To
introduce learners to
reference documents
tutorials
featured programs
links to announcements, forum, blogs and
wiki.
The Small Basic Curriculum is available to
download here: http://msdn.microsoft.com/engb/beginner/gg749839.aspx.
programming with Small Basic you
could provide them with small
‘how to’ programs. These could be
reused, extended or adapted to
provide solutions to other
problems.
Practitioners could download the series of Small Basic Lessons in PowerPoint
format or use them online if preferred. You will also find the links to
‘Introducing Small Basic’, ‘Small Basic Getting Started Guide’ and ‘Small
Basic E-Books’ on this website.
The materials mentioned above could be used to introduce learners to
engaging and creative tasks within the Small Basic environment.
Differentiated lessons are available within these materials and these could
allow for flexibility in learning approaches and styles.
Mobile phone example
Problem specification
Design, write and test a program to calculate and display a comparison table
of the running costs for contract mobile phones over a 12, 18 or 24 month
period. The number of comparisons allowed should be between two and four,
inclusive. Inputs should be the number of contracts to be compared, length of
contract, make and model of the mobile phone, initial cost of the mobile
phone(this could be 0) and cost per month for the contract.
Example program output:
14
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
ADVICE AND GUIDANCE FOR PRACTITIONERS
Software development process
The following example shows how a prototyping model could be use d to
create a program like the mobile phone example.
Analysis
The information below could be gathered by running and using an executable
version of the example program.






Input required
Input validation being used
Repeating input (loops)
Decisions required (If..Else)
Calculations made
Format of the output
Suggested learning approach:
Practitioners could supply the
learners with a test table
containing normal, extreme and
exceptional test data. This could
help to ensure that the
functionality of the program has
been fully tested.
Design
Learners would not be expected to jump
straight to designing the full solution at the
start of the activity. They could write down
the main steps (pseudocode) they need to
carry out to solve the problem and this could
be refined further as they create the program
following the prototyping model.
Suggested learning approach:
Learners could be asked to
write/think about the names and
data types of the variables to be
used in the program along with
any constructs they may require.
Modelling
Learners could start with the development of a simple program that will carry
out the main actions. Test it to ensure it gives the requi red output. Add the
other required program features one at time and test it each time a new
feature is added until the program requirements have been fulfilled.
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
15
ADVICE AND GUIDANCE FOR PRACTITIONERS
Version 1: Ask the user to enter the manufacturer of the phone then display it
in the output window.
Version 1 test run
Version 2: Add lines of code in the ‘Get Data’ section to ask for the model,
initial cost, contract length and cost per month. Then update the ‘Display
Results’ section to show the input data.
Version 2 test run
16
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
ADVICE AND GUIDANCE FOR PRACTITIONERS
Version 3: Clear the input data before displaying the results.
Version 3 test run
Version 4: Write the code to calculate the total cost of the contract and then
display the result under the ‘Cost Per Month’ output.
Version 4 test run
Version 5: Move to the top of your program and enter code to ask the user
how many mobile phone contracts they want to compare.
Version 5 test run
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
17
ADVICE AND GUIDANCE FOR PRACTITIONERS
Version 6: Write code to ensure that the user has input a correct number of
contracts. (Note: Acceptable input must be no less than 2 and no more than
4.)
Version 6 test run
Version 7: As your program now takes in the number of
contracts to compare, the next step is to add a fixed
loop(s) to the program to repeat the data input and output
displayed for each contract.
Suggested learning approach: This could be
a good point to discuss/demonstrate
variables and arrays. The assumption is that
most learners will add one fixed loop from
the ‘Get data’ to the ‘Display Results’
section on their first attempt.
Extension: Practitioners could
discuss/demonstrate subroutines here.
Version 7
test run:
Oops! Where
are the data
for the other
entries?
18
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
ADVICE AND GUIDANCE FOR PRACTITIONERS
Version 8: Change your variables to arrays to store the lists of data for each
mobile phone and use two fixed loops, one around ‘Get data’ and ‘Calculate
data’ and the other around ‘Display Results’.
Version 8 test run
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
19
ADVICE AND GUIDANCE FOR PRACTITIONERS
Version 9: Display the program output in a table.
Version 9 test run
Practitioners could leave Version 9 as the final program, although it leaves
the possibility of different contract lengths being input. This could be a point
for discussion and a chance to promote creativity as learners use the skills
they have gained in the use of computational constructs to develop the
program further.
Note: This is an example of how versions of the program could be developed.
See page 9for advice on version control.
A solution to the example problem developed using Small Basic is available
in Appendix 7.
20
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
ADVICE AND GUIDANCE FOR PRACTITIONERS
The graduation tool in Small Basic
As stated on page 13 programs written in Small Basic can be automatically
‘graduated’ to Visual Basic, which could help learners in their progression to
Higher Computing Science and more complex languages.
Using the graduate tool
Graduate tool
Suggested learning approach:
Learners could use the graduate
tool then look at, discuss and
compare the Small Basic and
Visual Basic versions of the same
program.
Export Window
Visual Basic Conversion Report
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
21
ADVICE AND GUIDANCE FOR PRACTITIONERS
Graduated mobile phone example program in Visual Basic
Suggested learning approach: This could be a
good point at which to discuss further the
declaration of variables and their data types.
The learners could then be asked to modify
the Visual Basic program code to demonstrate
their understanding.
(Note: On conversion to Visual Basic the
variables are declared and given data type as
Primitive.)
Visual Basic output
One additional line of code was added at the bottom of the program to hold
the output window view: TextWindow.Pause()
Appendix 8 shows the Visual Basic code for the example program created by
the graduation (export) process.
22
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
ADVICE AND GUIDANCE FOR PRACTITIONERS
Other potential learning approaches
Either of the following learning approaches could also be used for the mobile
phone example.
1.
Reusing and remixing
Begin by using examples of simple problems and their program
solutions. These examples could be useful in building new programs by
reusing and remixing the required code sections. Worked example
programs could increase in complexity and along with support notes
could be used to allow learners to create solutions to increasingly
complex problems. Study the given problem and reuse and remix your
previous programs to create a solution.
2.
Abstracting and modularising
Study the given problem and the
sections of code that you have been
given. Map out the problem. Run the
pieces of code to help you understand
the task they perform. Extract the
required sections of code and build a
solution.
Suggested learning approach:
Abstracting and modularising
could work well as a group
activity.
The table in Appendix 5 shows how computational thinking skills can be
developed when creating programs using Small Basic. Appendix 6 shows how
using Small Basic can link to the National 5 outcomes.
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
23
ADVICE AND GUIDANCE FOR PRACTITIONERS
Possible limitations of Small Basic
 All variables are global.
 Variables can be used before they are assigned .
 It does not have a data type system that is visible to the programmer.
(Note: String and numeric constants can be created and assigned to
variables and the operations performed on them will be interpreted
according to the content. Small Basic internally uses four data types:
integer (32 bit), real (64 bit), string (<32 KB on 16 bit/2 GB on 32 bit) and
array (~2970 elements on 16 bit/~50M elements on 32 bit).
Next steps
Teaching software development through the creation of games using Scratch
and developing computational thinking may be an engaging and relevant
approach to take with your learners. Combining this approach with a more
traditional language like Small Basic could allow your learners to learn the
knowledge and skills required at National 5 level and lay the foundations for
progression to Higher. The computational thinking skills the learners will
develop could be applied to the solution of problems in any software
development environment at National 5 level and beyond.
24
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
ADVICE AND GUIDANCE FOR PRACTITIONERS
Appendix 1: Computational thinking
Adapted from P.8
http://scratched.media.mit.edu/sites/default/files/CurriculumGuide v20110923.pdf
Computational thinking connections
The following tables summarise the computationa l thinking framework and
define its constituent components.
Computational concepts
Concept
Description
Sequence
Identifies a series of steps for a task
Loops
Run the same sequence multiple times
Parallelism
Makes things happen at the same time
Events
One thing causes another thing to happen
Conditionals
Make decisions based on conditions
Operators
Support for mathematical and logical expressions
Data
Storing, retrieving and updating values
Computational practices
Practice
Description
Being iterative and
incremental
Developing a little bit, then trying it out, then
developing some more
Making sure that things work – and finding and fixing
mistakes
Making something by building on what others – or
you – have done
Building something large by putting together
collections of smaller parts
Testing and debugging
Reusing and remixing
Abstracting and
modularising
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
25
ADVICE AND GUIDANCE FOR PRACTITIONERS
Computational perspectives
Perspective
Expressing
Connecting
Questioning
26
Description
Realising that computation is a medium of creation
‘I can create’
Recognising the power of creating with and for others
‘I can do different things when I have access to others’
Feeling empowered to ask questions about the world
‘I can (use computation to) ask questions to make sense of
(computational things in) the world’
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
ADVICE AND GUIDANCE FOR PRACTITIONERS
Appendix 2: List of scripts created for Asteroid Invaders
Sprite
Step/script
Title screen
Show title screen for 3 seconds.
Stage
Start 30-second countdown timer.
Play music until lives or time left = 0.
Display values of variable on screen once title screen disappears.
Gunship
Set lives = 3 at start of game.
Move gunship to bottom centre of stage.
Move gunship left and right with arrow keys.
If gunship is touched by asteroid make gunship fade, play sound and
lose a life.
If gunship loses all lives, broadcast ‘Game Over’ to other sprites.
Bullet
Set score = 0 at start of game.
Hide bullet at start of game.
When game started make bullet constantly shoot upwards (when it’s
hidden).
When spacebar pressed, make bullet switch to costume 1, appear and
line up with gunship.
When spacebar pressed, play laser sound effect.
When bullet touches asteroid, play sound effect, change costume,
disappear and increase score by 1 point.
Make bullet disappear if it touches the top of the stage.
Asteroid
(same
scripts for
all four
asteroids)
‘Game
Over’
screen
When game starts make asteroid spawn at random position and glide
to a random position for a random amount of time between 1 and 3
seconds.
If touching bullet, change costumes to show expl osion and then hide
before re-spawning 1 second later.
Hide ‘Game Over’ screen when game started.
When time = 0, show ‘Game Over’ screen, hide lives and time
variables, play sound effect and end game.
When ‘Game Over’ broadcast is received, show ‘Game Over’ screen,
hide lives and time variables, play sound effect and end game.
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
27
ADVICE AND GUIDANCE FOR PRACTITIONERS
Appendix 3: Developing computational thinking with Scratch
The following exemplar table demonstrates how Scratch can help learners
develop their computational concepts, practises and perspectives.
Computational concepts
Concept
Description
Scratch example from Asteroid Invaders
Sequence
Identifies a series of
steps for a task
Run the same
sequence multiple
times
This script is attached to the bullet of the gunship. Once the
start flag is pressed the sequence of tasks constantly checks to
see if the bullet is touching an asteroid. If this is true a noise is
made, the bullet switches costumes to give the effect of it
exploding and disappearing, and the player’s score increases by
1 point.
Makes things happen
at the same time
This script gives the illusion of an asteroid exploding when it
is shot by a bullet. Like the script for the bullet above, it is
initiated when the start flag is pressed, therefore these scripts
work in parallel.
Loops
Parallelism
28
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
ADVICE AND GUIDANCE FOR PRACTITIONERS
Events
Conditionals
Operators
Data
One thing causes
another thing to
happen
Make decisions
based on conditions
Support for
mathematical and
logical expressions
Storing, retrieving,
and updating values
Despite using very few blocks, the following script uses a
condition, operator and data to stop the game when the gunship
loses all of its lives.
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
29
ADVICE AND GUIDANCE FOR PRACTITIONERS
Computational practices
Practice
Being
iterative and
incremental
Testing and
debugging
Reusing and
remixing
Abstracting
and
modularising
30
Description
Developing a
little bit, then
trying it out,
then developing
some more
Making sure
that things work
– and finding
and fixing
mistakes
Making
something by
building on
what others – or
you – have done
Building
something large
by putting
together
collections of
smaller parts
Scratch example from Asteroid Invaders
The initial design for Asteroid Invaders listed five steps. Each of
these steps was completed in turn before refining the steps and
adding more functionality to the game.
Testing and debugging is almost immediate using Scratch. Once
the blocks have been assembled, the script can be tested to see if
it works properly.
The official Scratch website contains games created by Scratch
programmers across the globe. Learners can use the scripts from
these games to help develop their own programming skill s. They
can also reuse scripts within games by dragging them onto other
sprites.
The image below shows that the actions of the gunship are
controlled by five different scripts.
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
ADVICE AND GUIDANCE FOR PRACTITIONERS
Computational perspectives
Perspective
Description
Expressing
Realising that computation is a
medium of creation
‘I can create’
Connecting
Recognising the power of
creating with and for others
‘I can do different things when
I have access to others’
Feeling empowered to ask
questions about the world
Questioning
‘I can (use computation to) ask
questions to make sense of
(computational things in) the
world’
By creating their own games in
Scratch, learners have the
opportunity to create and solve their
own ‘problems’.
Learners can create their own games
or divide the creation of scripts
between partners or groups.
Learners can work with others
across the globe to refine and
improve their games.
Learners develop questioning skills
throughout the process of software
development using Scratch. Finding
their own answers to these questions
prepares them for situations where
they will need to use creativity and
logic to solve problems in the wider
world.
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
31
ADVICE AND GUIDANCE FOR PRACTITIONERS
Appendix 4: Linking Scratch to the National 5 outcomes
The following table illustrates how the skills developed through practical
programming could help learners better understand the underlying
programming theory and concepts.
The learners
will engage in
Selecting and
using a
combination
of
expressions,
sequence,
selection,
iteration and
pre-defined
functions
Example script from creation of game using Scratch
The following script is attached to the gunship’s bullet. If the bullet touches
any of the asteroids a noise is made, the bullet breaks up into two parts,
disappears after half a second and the score is increased by 1 point. It uses
sequence, selection, iteration and pre-defined functions.
The following script uses expression, sequence, selection, iteration and a predefined function to stop the game when the gunship loses all of its lives.
32
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
ADVICE AND GUIDANCE FOR PRACTITIONERS
Selecting and
using
appropriate
simple data
types such as
numeric
(integer and
real), string
and Boolean
The following script shows how Boolean, integer and real data types are used
to move between costumes and give the impression that the asteroid has been
blown up before it reappears after 1 second.
Testing digital
solutions,
using their
own test data
Identifying
and rectifying
errors in
programs
Providing
internal
commentary
or
documentation
Learners will test their program every time they add a new block of code. They
can create their own test schedules to make sure that their game works as it
should. A simple example would be to test that the gunship in Asteroid
Invaders moves left and right when the left and right arrow keys are pressed.
Learners will identify and rectify errors in their games as they test their
scripts. Learners could also ask classmates to test and evaluate their games.
Reading and
explaining
code
Describing the
purpose of a
range of
programming
constructs and
how they
work
You could provide learners with screenshots of unfamiliar Scratch programs.
Ask them to describe what they think the code does.
Scratch allows project notes to be added to the game as well as internal
commentary, as shown below.
You could select some games created by your learners and demonstrate them
working to your class. You could then highlight several constructs and explain
the role they play in the game. You could ask learners to comment the scripts
in their own games and explain what the constructs do in their own games.
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
33
ADVICE AND GUIDANCE FOR PRACTITIONERS
Describing the
purpose and
role of
variables
Describing in
simple terms
how programs
relate to low
level
operations and
structures
34
Learners are familiar with the use of ‘lives’, ‘scores’ and ‘timers’ in games.
You could use these to describe the role of variables and how their contents
can change.
The Scratch programming language was written using Squeak. You could
explain to learners that every block they use in their scripts has corresponding
Squeak code attached to it. The learners only need to understand the Scratch
blocks and what they do. They don’t need to worry about Squeak. But each
time they play their game the Squeak code attached to their blocks is translated
into machine code that the processor understands. By using easy -to-recognise
blocks that represent code, learners are able to give instructions to the
processor without having to memorise any code. As they develop their
programming skills and become more familiar with text -based environments
learners will learn to work with and memorise code.
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
ADVICE AND GUIDANCE FOR PRACTITIONERS
Appendix 5: Developing computational thinking with Small
Basic
Concept
Sequence
Description
Identifies a
series of
steps for a
task
Example(s)
1. Get a number
Loops
Run the
same
sequence
multiple
times
‘While the number of contracts are less than 2 or greater than 4 repeat
the following instructions
Whilenumcontracts<2Ornumcontracts>4
TextWindow.Write("DATA ENTRY ERROR!
Please check and re-enter:")
‘Display message and ask to reenter
numcontracts=TextWindow.Read() ‘Place the data entered by the
user inthe variable numcontracts
EndWhile
‘Stop repeating the instructions
valid data has been entered
Forgetappname=1To5
‘Carry out the following
instructions five times
TextWindow.Write("Enter the name of the application: ")
applicationname[getappname]=TextWindow.Read()
EndFor
‘End of the for loop the instructions
have been carried out five times
'Get a number
TextWindow.Write("Please enter a
number: ")
number=TextWindow.Read()
2. Calculate the square root 'Calculate the square root of the
number
SqRnumber=Math.SquareRoot(number)
3. Display the result
'Display the result
TextWindow.WriteLine(SqRnumber +"
is the square root of "+number)
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
35
ADVICE AND GUIDANCE FOR PRACTITIONERS
Parallelism
Makes things
happen at the
same time
In this example rectangles are created and displayed in a grid, then
using the animation command some of the rectangles are moved to
the top left corner of the output window. Ellipses appear from the top
left corner and move to the vacated spaces in the grid.
numberofrows=8
numberofcolumns=8
size=40
Forrows=1Tonumberofrows
Forcolumns=1Tonumberofcolumns
GraphicsWindow.BrushColor=GraphicsWindow.GetRandomColor()
boxes[r][c]=Shapes.AddRectangle(size,size)
Shapes.Move(boxes[r][c],c*size,r*size)
EndFor
EndFor
Forr=1TonumberofrowsStep2
Forc=1TonumberofcolumnsStep2
Shapes.Animate(boxes[r][c],0,0,10000)
EndFor
EndFor
Forr=1TonumberofrowsStep2
Forc=1TonumberofrowsStep2
GraphicsWindow.BrushColor=GraphicsWindow.GetRandomColor()
boxes[r][c]=Shapes.AddEllipse(size,size)
Shapes.Animate(boxes[r][c],c*size,r*size,10000)
EndFor
EndFor
Events
36
One thing
causes
another thing
to happen
Creating interactivity in a program. When the mouse is clicked (left
or right) it triggers an event; in this case it delivers a message.
GraphicsWindow.MouseDown=mouse_click
Submouse_click
GraphicsWindow.ShowMessage("Your wish is
my command!","You Clicked")
EndSub
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
ADVICE AND GUIDANCE FOR PRACTITIONERS
Conditionals
Make
decisions
based on
conditions
Operators
Support for
mathematical
and logical
expression
Data
Storing,
retrieving
and updating
values
ifoption=1Then
‘If the user has selected option 1 then
contractlength = 12
‘the contract length is 12 months
Else
‘otherwise
Ifoption=2Then
‘If the user has selected option 2 then
contractlength=18
‘the contract length is 18 months
Else
‘otherwise
contractlength=24
‘the contract length is 24 months
EndIf
‘end the if statement
EndIf
‘end the if statement
Small Basic provides lots of mathematical pre-defined functions in
its ‘Math class’:Pi, Abs, ArcCos, ArcSin, ArcTan, Ceiling, Cos,
Floor, GetDegrees, GetRadians, GetRandomNumber, Log, Max,
Min, NaturalLog, Power, Remainder, Round, Sin, SquareRoot and
Tan.
+ is used for addition and concatenation
-, *, \ subtraction, multiplication and division
=, <> equal, not equal
>, >= greater than, greater than or equal to
<, <= less than, less than or equal to
And returns true if both inputs are true
Or returns true if either one of the inputs is true
Coded examples
SqRnumber=Math.SquareRoot(number)
areaofcircle=Math.pi*Math.Power(radius,2)
Whilenumcontracts<2Ornumcontracts>4
TextWindow.WriteLine(SqRnumber + " is the square root of " +
number)
Variables can be used to store data; these can be assigned new
values and accessed as required.
yournumber=0
TextWindow.WriteLine("The contents of variable yournumber =
"+yournumber)
TextWindow.Write("Please enter a number: ")
yournumber=TextWindow.Read()
TextWindow.WriteLine("The contents of variable yournumber
have changed to = "+ yournumber)
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
37
ADVICE AND GUIDANCE FOR PRACTITIONERS
Appendix 6: Linking Small Basic to Skills Development
The following table is an illustration of how the skills developed through
practical programming could help learners bette r understand the underlying
programming theory and concepts using Small Basic.
Develop short programs using one or more software development environments by:
Selecting and using a
OrderTotal = (NumProducts * Cost) – Discount
combination of
expressions, sequence,
totalcost[counter] = (contractlength * costpermonth[counter]) +
selection, iteration and
initialcost[counter]
pre-defined functions
If Mark > 50 then
Result = "Pass"
Else
Result = "Fail"
EndIf
For number = 1 To 10
TextWindow.WriteLine(number)
EndFor
While numcontracts < 2 Or numcontracts > 4
TextWindow.Write("DATA ENTRY ERROR! Minimum
contracts 2, maximum 4, please re-enter:")
numcontracts = TextWindow.Read()
EndWhile
Selecting and using
appropriate simple data
types such as numeric
(integer and real), string
and Boolean
Testing digital solutions,
using their own test data
Identifying and rectifying
errors in programs
38
SqRnumber = Math.SquareRoot(number)
RoundNumber = Math.Round(number)
TextWindow.WriteLine("Please enter the number for your choice:
1, 2 or 3")
option = TextWindow.Read() Integer variable
TextWindow.Write ("Please enter the manufacturer of the mobile
phone: ")
manufacturer[counter] = TextWindow.Read() String array
Testing could be carried out on each section of the code as it is
built. Further testing could be done when the program is
completed.
Learners could identify and rectify syntax and grammatical errors
as they occur and use the test data created to ensure the program
output is correct. Programming ‘buddies’ co uld be used to help
each other in this task.
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
ADVICE AND GUIDANCE FOR PRACTITIONERS
Providing internal
commentary or
documentation
Comment lines could be used to clearly describe the coded
instructions.
Explain how programs work, drawing on understanding of concepts in software
development and basic computer architecture by:
Reading and explaining
Be a programming ‘buddy’ for a peer. This could require the
code
learner to read and interpret code created by another.
Describing the purpose of As learners become more confident in their problem-solving and
a range of programming
programming ability they could draw on these skills to help them
constructs and how they
describe the programming constructs they have used and how they
work
work. This could create a greater overall understanding an d
confidence in their own ability rather than a reliance on
practitioner-led descriptions of programming constructs.
Describing the purpose
You could approach this by using a simple example program(s)
and role of variables
and test data table(s) for the learners to complete. The completed
testing could be a basis for discussion.
Describing in simple
You could use practitioner-created notes and class discussion to
terms how programs
help learners understand how programs relate to low-level
relate to low-level
operations and structures.
operations and structures
Produce a short detailed report comparing two contemporary software development
languages or environments by:
Describing how each
You could create a template document that the learners could use
represents standard
as a basis for their report. This could contain the standard
constructs
constructs, data types and editing features to be compared.
You could create example comparison documents using different
Comparing the range of
programming languages that could be discu ssed in groups or by
data types provided
the whole class to help the learners understand the requirements
Comparing their editing
of the task.
features
Describing how highlevel code is translated
and executed
You could use practitioner-created notes and class discussion to
help learners understand how HLL code is translated and
executed. This could be followed up with questioning to
determine the level of understanding and, if required, prompt
further discussion/work before the report is written.
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
39
ADVICE AND GUIDANCE FOR PRACTITIONERS
Appendix 7: Example Small Basic solution for the mobile
phone problem
'Program Description: This program calculates and displays a comparison
table of the 'running costs for two to four contract mobile phones over a 12,
18 or 24 month period.
'Ask for the number of contracts to be compared
TextWindow.Write("Please enter the number of contracts (min = 2, max = 4)
you wish to compare: ")
numcontracts = TextWindow.Read()
'Validate input contract length
While numcontracts < 2 Or numcontracts > 4
TextWindow.Write("DATA ENTRY ERROR! The number of contracts
should be between 2 and 4 inclusive, please re -enter:")
numcontracts = TextWindow.Read()
EndWhile
'Display and select contract length
TextWindow.WriteLine("")
TextWindow.WriteLine("LENGTH OF CONTRACT")
TextWindow.WriteLine("")
TextWindow.WriteLine("1: Twelve Months")
TextWindow.WriteLine("2: Eighteen Months")
TextWindow.WriteLine("3: Twentyfour Months")
TextWindow.WriteLine("")
TextWindow.Write("Please enter the number for your choice : 1, 2 or 3: ")
option = TextWindow.Read()
'Validate input option
While option < 1 Or option > 3
TextWindow.Write("ERROR! Please enter option number 1, 2 or 3: ")
option = TextWindow.Read()
EndWhile
if option = 1 Then
contractlength = 12
Else
If option = 2 Then
contractlength = 18
40
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
ADVICE AND GUIDANCE FOR PRACTITIONERS
Else
contractlength = 24
EndIf
EndIf
'Collect contract data
For counter = 1 To numcontracts
TextWindow.WriteLine("")
TextWindow.Write ("Please enter the manufacturer of the mobile phone: ")
manufacturer[counter] = TextWindow.Read()
TextWindow.Write ("Please enter the model of the mobile phone: ")
model[counter]= TextWindow.Read()
TextWindow.Write ("Please enter initial cost of the phone: ")
initialcost[counter]= TextWindow.Read()
TextWindow.Write ("Please enter cost per month for the contract: ")
costpermonth[counter]= TextWindow.Read()
EndFor
'Calculate contract data
For totalcounter = 1 To numcontracts
totalcost[totalcounter] = (contractlength * costpermonth[totalcounter]) +
initialcost[totalcounter]
EndFor
'Display contract comparison details
TextWindow.Clear()
TextWindow.ForegroundColor = "Yellow"
TextWindow.WriteLine ("MOBILE PHONE CONTRACT COMPARISON
DETAILS ")
TextWindow.WriteLine ("Length of contract selected: " + contractlength + "
months.")
TextWindow.WriteLine("")
TextWindow.Write ("Manufacturer")
TextWindow.CursorLeft = 15
TextWindow.Write ("Model")
TextWindow.CursorLeft = 25
TextWindow.Write ("Initial Cost")
TextWindow.CursorLeft = 40
TextWindow.Write ("Cost Per Month")
TextWindow.CursorLeft = 60
TextWindow.Write ("Total Cost")
TextWindow.WriteLine("")
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
41
ADVICE AND GUIDANCE FOR PRACTITIONERS
For counter2 = 1 To numcontracts
TextWindow.Write(manufacturer[counter2])
TextWindow.CursorLeft = 15
TextWindow.Write(model[counter2])
TextWindow.CursorLeft = 25
TextWindow.Write("£" + initialcost[counter2])
TextWindow.CursorLeft = 40
TextWindow.Write("£" + costpermonth[counter2])
TextWindow.CursorLeft = 60
TextWindow.WriteLine("£" + totalcost[counter2])
EndFor
TextWindow.WriteLine("")
42
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
ADVICE AND GUIDANCE FOR PRACTITIONERS
Appendix 8: Mobile phone solution graduated from Small Basic to Visual Basic
Module Mobile_Phone_FinalModule
Dim numcontracts, __option, contractlength, counter, manufacturer, model, initialcost, costpermonth, totalcounter, totalcost,
counter2 As Primitive
Sub Main()
'Program Description: This program calculates and displays a comparison table of ‘the running costs for two to four contract
mobile phones over a 12, 18 or 24 ‘month period.
'Ask for the number of contracts to be compared
TextWindow.Write("Please enter the number of contracts (min = 2, max = 4) you wish to compare: ")
numcontracts = TextWindow.Read()
'Validate input contract length
While (numcontracts < 2) Or (numcontracts > 4)
TextWindow.Write("DATA ENTRY ERROR! The number of contracts should be between 2 and 4 inclusive, please reenter:")
numcontracts = TextWindow.Read()
End While
'Display and select contract length
TextWindow.WriteLine("")
TextWindow.WriteLine("LENGTH OF CONTRACT")
TextWindow.WriteLine("")
TextWindow.WriteLine("1: Twelve Months")
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
43
ADVICE AND GUIDANCE FOR PRACTITIONERS
TextWindow.WriteLine("2: Eighteen Months")
TextWindow.WriteLine("3: Twentyfour Months")
TextWindow.WriteLine("")
TextWindow.Write("Please enter the number for your choice: 1, 2 or 3: ")
__option = TextWindow.Read()
'Validate input option
While (__option < 1) Or (__option > 3)
TextWindow.Write("ERROR! Please enter option number 1, 2 or 3: ")
__option = TextWindow.Read()
End While
If __option = 1 Then
contractlength = 12
Else
If __option = 2 Then
contractlength = 18
Else
contractlength = 24
End If
End If
'Collect contract data
For counter = 1 To numcontracts
TextWindow.WriteLine("")
TextWindow.Write("Please enter the manufacturer of the mobile phone: ")
44
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
ADVICE AND GUIDANCE FOR PRACTITIONERS
manufacturer(counter) = TextWindow.Read()
TextWindow.Write("Please enter the model of the mobile phone: ")
model(counter) = TextWindow.Read()
TextWindow.Write("Please enter initial cost of the phone: ")
initialcost(counter) = TextWindow.Read()
TextWindow.Write("Please enter cost per month for the contract: ")
costpermonth(counter) = TextWindow.Read()
Next
'Calculate contract data
For totalcounter = 1 To numcontracts
totalcost(totalcounter) = (contractlength * costpermonth(totalcounter)) + initialcost(totalcounter)
Next
'Display contract comparison details
TextWindow.Clear()
TextWindow.ForegroundColor = "Yellow"
TextWindow.WriteLine("MOBILE PHONE CONTRACT COMPARISON DETAILS ")
TextWindow.WriteLine("Length of contract selected: " + contractlengt h + " months.")
TextWindow.WriteLine("")
TextWindow.Write("Manufacturer")
TextWindow.CursorLeft = 15
TextWindow.Write("Model")
TextWindow.CursorLeft = 25
TextWindow.Write("Initial Cost")
TextWindow.CursorLeft = 40
TextWindow.Write("Cost Per Month")
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
45
ADVICE AND GUIDANCE FOR PRACTITIONERS
TextWindow.CursorLeft = 60
TextWindow.Write("Total Cost")
TextWindow.WriteLine("")
For counter2 = 1 To numcontracts
TextWindow.Write(manufacturer(counter2))
TextWindow.CursorLeft = 15
TextWindow.Write(model(counter2))
TextWindow.CursorLeft = 25
TextWindow.Write("£" + initialcost(counter2))
TextWindow.CursorLeft = 40
TextWindow.Write("£" + costpermonth(counter2))
TextWindow.CursorLeft = 60
TextWindow.WriteLine("£" + totalcost(counter2))
Next
TextWindow.WriteLine("")
TextWindow.Pause()
End Sub
End Module
46
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
ADVICE AND GUIDANCE FOR PRACTITIONERS
Appendix 9: Table of hyperlinks and downloads used in this
document
Description
URL
Description of computational
thinking
http://scratched.media.mit.edu/sites/d
efault/files/computational%20thinkin
g%20article.pdf
Official Scratch homepage
http://scratch.mit.edu/
Scratch resources and lesson plans
http://scratched.media.mit.edu/
Example solution to the Asteroid
Invaders problem
http://scratch.mit.edu/users/N5Scratch
Official Small Basic website
http://smallbasic.com/
Download Small Basic
www.microsoft.com/download/en/det
ails.aspx?id=14246
Download the Small Basic
Curriculum
http://msdn.microsoft.com/engb/beginner/gg749839.aspx
APPROACHES TO SOFTWARE DESIGN AND DEVELOPMENT (NATIONAL 5, COMPUTING SCIENCE)
© Crown copyright 2012
47
Download