Slides badge

Design

  1. List the steps for making a cup of tea
  2. Create a structure diagram and flowchart for making a cup of tea

Lesson starter

A cup of tea - flowchart

A cup of tea - structure diagram

Learning Intentions

  • Describe and compare different means of software design
  • Use the different design tools to design software
  • Describe data flow between sections of a program

Success Criteria

  • Be able to describe and use structure diagrams, flowcharts and pseudocode.
  • Use a data flow diagram to show the flow of data

Design notations

  • There are 3 different design notations that we need to know at National 5. These are:
    • Structure diagrams
    • Flowcharts
    • Pseudocode

Design notations: Structure diagrams

  • A structure diagram uses a variety of standard symbols with text to represent the order of events required to solve a problem.

Design notations: Structure diagrams

total = 0

for counter in range (0, 10):
  print("Please insert a number")
  number = int(input())

  while number < 0 or number > 10:
    print("Try again")
    number = int(input())

  total = total + number

print(total)

Structure diagram Symbols

Design notations: Structure diagrams

for counter in range (1, 6):
  print(counter)

Design notations: flowcharts

  • A flowchart uses a variety of standard symbols with text to represent the order of events required to solve a problem.
  • Flowcharts aren't just used in software design

Design notations: flowcharts

  • Special symbols represent each different action or control sequence in the code.

Class task and discussion

  • Create a flow chart or structure diagram that loops, asking the user for a number each time and adding it to a total variable, until the user types in 0. Extension: try creating this in Python.
  • Create a flow chart or structure diagram for taking in 10 grades and verifying they are between 0 and 100 (inclusive) and adding them to an array.

Pseudocode

  • Pseudocode is a kind of structured English for describing algorithms and intended for human reading.
  • It is a textual design notation.
  • It can look like code but it doesn’t have the same strict syntax.
  • We should start by thinking about the main steps to solve a problem.  We should then refine the steps so we have one line of pseudocode for each line of program code.

Pseudocode example

  • Lets consider calculating the volume of water in a swimming pool.
    What would be the main steps for the problem?
     
    Main Steps
    Ask user to enter dimensions of pool in metres
    Calculate volume of pool
    Display message stating the volume of the pool

Pseudocode example

  • How would we refine these main steps?
     
    Main Steps
    1. Ask user to enter dimensions of pool
    2. Calculate volume of pool
    3. Display message stating the volume of the pool
     
    Refinement
    1.1 Ask the user to enter the length of pool
    1.2 Ask the user to enter the width of pool
    1.3 Ask the user to enter the depth of pool
     
    2.1 Volume = length x width x depth
     
    3.1 Display “The volume of the pool is”, volume

Pseudocode example

  • How would we refine these main steps?
     
    Main Steps
    1. Ask user to enter dimensions of pool
    2. Calculate volume of pool
    3. Display message stating the volume of the pool
     
    Refinement
    1.1 Ask the user to enter the length of pool
    1.2 Ask the user to enter the width of pool
    1.3 Ask the user to enter the depth of pool
     
    2.1 Volume = length x width x depth
     
    3.1 Display “The volume of the pool is”, volume

OUT: length, width, depth

IN: length, width, depth OUT: volume

Top Level Design

  • When a problem is first addressed, it is written very vaguely. 
  • For example, in a structure diagram you might find a block that says Calculate the Average, but this doesn't tell you how this is done.
  • As shown on the previous slide, we can refine our program designs to make them more granular (or atomic) and give us more detail. 

Data flow

This is a very common coursework task

  1. Draw a data flow diagram for making a cup of tea
  2. Pick out one of your own programs using and describe the data flow between each of the parts of the program

Task

Review

The top‑level design of the main steps of the program is shown below.


Complete the diagram to show the data flow for the program.

 

 

 

 

 

 

2 marks

2022 Q7(b)

Presentation Overview
Close
JB
Design
© 2020 - 2024 J Balfour
19:34 | 23-05-2024
Join Live Session
Start Remote
Save Progress
Slideshow Outline
Presenter Mode
Widget Screen
Canvas Controls
Random Selector
Timer
Volume Meter
Binary Converter
Python Editor
Show Knox 90
Provide Feedback
Help
!
Keywords
    DragonDocs Management
    Random selector
    Sections
      Binary conversion
      Denary to binary conversion
      Binary to denary conversion
      Feedback 👍
      Accessibility

      Apply a filter:

      ×
      All slideshow files