level 3 computing year 1 lecturer: phil...

19
Level 3 Computing Year 1 Lecturer: Phil Smith

Upload: phamtu

Post on 09-May-2018

215 views

Category:

Documents


1 download

TRANSCRIPT

Level 3 Computing

Year 1

Lecturer: Phil Smith

Learning outcomes Now we will continue to learn about tools for software design.

Tools.

Flow Charts.

Pseudo code.

This is the final part of learning outcome 3 “Be able to use tools to demonstrate software designs”.

BTEC Level 3 Year 1 - Unit 6 Software Design and Development, Phil Smith

Designing a Program All programs need to be designed and there a number

of ways and defined processes to achieve this.

You have already covered flow charts in previous units so we shall review flowcharts now,

Flow charts.

BTEC Level 3 Year 1 - Unit 6 Software Design and Development, Phil Smith

Designing a Program

An example flowchart

BTEC Level 3 Year 1 - Unit 6 Software Design and Development, Phil Smith

Flow charting Flowcharting is a tool for analysing processes. It allows

you to break any process down into individual events or activities and to display these in shorthand form showing the logical relationships between them. Constructing flowcharts promotes better understanding of processes, and better understanding of processes is a pre-requisite for improvement.

http://www.hci.com.au/flowcharting-a/

BTEC Level 3 Year 1 - Unit 6 Software Design and Development, Phil Smith

Flow charting All diagrams need a start and an end.

Start End

BTEC Level 3 Year 1 - Unit 6 Software Design and Development, Phil Smith

Flow charting – basic symbols

Connector Decision

Process Input/Output

Data

BTEC Level 3 Year 1 - Unit 6 Software Design and Development, Phil Smith

Flow charting – basic symbols

Off page connector

Pre-defined process

Display Data storage

BTEC Level 3 Year 1 - Unit 6 Software Design and Development, Phil Smith

Flow charting – basic rules Flow charts are written top to bottom.

They can exit from the right.

They can enter from the left.

Page connectors are used when more than one page is required.

Arrows are used to show the flow.

Let’s look at a sample.

Page 1

BTEC Level 3 Year 1 - Unit 6 Software Design and Development, Phil Smith

Flow charting – Task 1

Part of the requirements for assignment 3 are:

The decorator needs to enter the height of the room (assume all walls are the same height i.e. no sloping ceilings). The height must be between 2.4m and 6m. The length of all four walls must be entered (minimum 1m and maximum 25m).

Produce a flowchart for this requirement.

BTEC Level 3 Year 1 - Unit 6 Software Design and Development, Phil Smith

Flow charting – For assignment 3 your flowchart will need to be

extended for the calculations and output.

BTEC Level 3 Year 1 - Unit 6 Software Design and Development, Phil Smith

Pseudo code Pseudocode provides a design technique which is very

close to the code that will eventually be written.

It’s a kind of ‘halfway house’ between the high level generalised techniques like structured diagrams and low level details that re required in the actual code. Pseudocode is also useful for working out how complex algorithms (mathematical formulae) will be written in program code.

BTEC Level 3 Year 1 - Unit 6 Software Design and Development, Phil Smith

Pseudo code The rules of Pseudo code are reasonably straightforward.

All statements showing "dependency" are to be indented.

These include while, do, for, if, switch.

BTEC Level 3 Year 1 - Unit 6 Software Design and Development, Phil Smith

Pseudo code – keywords to use For looping and selection, The keywords that are to

be used include

Do While...EndDo; Do Until...Enddo; Case...EndCase; If...Endif; Call ... with (parameters); Call; Return ....; Return; When;

Always use scope terminators for loops and iteration, even though Python does not use them.

BTEC Level 3 Year 1 - Unit 6 Software Design and Development, Phil Smith

Pseudo code – keywords to use As verbs, use the words Generate, Compute,

Process, etc. Words such as set, reset, increment, compute, calculate, add, sum, multiply, ... print, display, input, output, edit, test , etc. with careful indentation tend to foster desirable pseudo code.

Do not include data declarations in your pseudo code.

BTEC Level 3 Year 1 - Unit 6 Software Design and Development, Phil Smith

Pseudo code – example Dim Num1 As Integer Dim

Num2 As Integer

Num1 = Text1.Text

Num2 = Text2.Text

If Num1 > Num2 Then MsgBox "Num1 is Greater than Num2"

If Num1 < Num2 Then MsgBox "Num2 is Greater than Num1"

If Num1 = Num2 Then MsgBox "Num1 and Num2 are equal"

Make Num1 as the text in Text1 Make Num2 as the text in Text2

if Num1 is greater than Num2 then "Num1 is greater than Num2"

else if Num1 is smaller than Num2 then "Num2 is Greater then Num1"

else if Num1 is equal to Num2 then "Num1 and Num2 are equal"

BTEC Level 3 Year 1 - Unit 6 Software Design and Development, Phil Smith

Pseudo code – Assignment 3

Task 4 (D2)

Develop an algorithm using pseudo-code to describe how the calculation should be done to estimate the cost of decorating for any given size of room, choice of paint and undercoat.

Try this now.

BTEC Level 3 Year 1 - Unit 6 Software Design and Development, Phil Smith

Assignment 3

That’s it.

BTEC Level 3 Year 1 - Unit 6 Software Design and Development, Phil Smith

You can now do Assignment 3.

Summary

Today we learnt about –

Dataflow diagrams.

Next we shall learn about –

Structure charts

Flow charts

Pseudo code

BTEC Level 3 Year 1 - Unit 6 Software Design and Development, Phil Smith