Software Development - PowerPoint PPT Presentation

1 / 136
About This Presentation
Title:

Software Development

Description:

Used tea bag. Boiled water. Cup of tea. Blob Diagram. Create a blob diagram for the ... Take making a cup of tea as an example. 1. Fill kettle. 2. Boil kettle ... – PowerPoint PPT presentation

Number of Views:60
Avg rating:3.0/5.0
Slides: 137
Provided by: stmc
Category:

less

Transcript and Presenter's Notes

Title: Software Development


1
Software Development
  • Higher

2
Software
  • What is software?
  • All programs that allow hardware to do something
    useful and interesting
  • You probably use several different pieces of
    software every day/week
  • Examples?
  • What is hardware?
  • Everything that you can touch

3
Software
  • A piece of software is simply a list of
    instructions that are fed to the computer and
    executed
  • It is therefore important that these instructions
    are in the correct order and the instructions
    themselves are correct

4
Questions(Int2)
  • What is the meaning of the term hardware?
  • Give three examples of software.
  • Complete the following table

5
The Development Process
  • The software development cycle is a systematic
    approach to producing software. The software
    development life cycle can be summed up in the
    following stages
  • Analysis
  • Design
  • Implementation
  • Testing
  • Documentation
  • Evaluation
  • Maintenance

6
Development Process
  • It can be difficult to remember all of these
    stages in order.
  • This little mnemonic might help.
  • Or, you might develop your own.
  • A Dance In The Dark Every Monday

ocumentat ion
valuation
aintenance
nalysis
mplementation
esting
esign
7
Software Development Process
  • Analysis To look at the problem and determine
    what the solution might be. Use existing systems
    or write a new program? Turn the rough idea into
    an exact description. What are the inputs and
    outputs? What type of computer will it be run on?
    All of these questions must be answered at this
    stage.

8
Who does it?
  • The systems analyst is the person who is
    responsible for the analysis stage

9
Skills of the Systems Analyst
  • Usually a skilled and experienced programmer
  • Good people skills
  • Good communication skills

10
What do they do?
  • Interview clients
  • Observation notes of existing practice
  • Questionnaires
  • All of these are categorised as requirements
    elicitation

11
The Importance of Being Anal
  • The systems analyst has to be very detailed and
    accurate
  • So the rest of the process runs smoothly
  • Examples of what could go wrong?
  • After requirements elicitation the analyst will
    create a requirements specification
    (program/problem specification) contains a
    full problem description, inputs and outputs etc

12
Put the following in the correct order
  • 1. Create a user manual
  • 2. Get the team together to discuss what the
    games purpose is and what kind of things the
    player will be able to do
  • 3. Create the game
  • 4. Fix the problems found in testing. Produce
    downloadable updates for the game
  • 5. Design the games characters and worlds.
    Produce a plan for when certain parts of the game
    should be finished
  • 6. Make sure the game works properly
  • 7. Allow some people to play the game and ask
    them what they think of it

13
Blob Diagram(analysis)
  • Used to determine the inputs and outputs to a
    program, using tea example

sugar
Tea bag
Used tea bag
Making tea
water
Boiled water
milk
Cup of tea
14
Blob Diagram
  • Create a blob diagram for the following program
  • A program that asks the user the length and
    breadth of a floor in metres. It will also ask
    the user the price of the carpet they will use
    (in m2) and then tells the user how much carpet
    will be required and the total cost
  • When you have done this, try to create the
    program in Visual Basic

15
Blog Entry The Software Development Lifecycle
  • Higher
  • The 7 stages of the SD Lifecycle
  • Analysis What happens here, who does it, how do
    they do it and what do they produce
  • Techniques what techniques are used
  • Int2
  • The 7 stages of the SD Lifecycle
  • Analysis What happens at this stage and what is
    produced
  • Blob diagramy

16
Blog Entry The Software Development Lifecycle
  • Update your blog on the Software Development
    lifecycle to include all of the new things you
    have learned about each stage.

17
Software Development Process
  • Design jumping straight into coding a program
    is not a good idea. This stage is important as
    the details of the program are worked out here.
    Things like how the screen will look, how the
    user will interact with the program and how the
    program might be structured. There are a variety
    of design methods. Pseudocode and structure
    diagrams are two of the most common.

18
Pseudocode
  • Like an English version of the program but can
    have code in it too if the designer knows how
    they will code it
  • If done properly the pseudocode should match the
    program line for line
  • Take making a cup of tea as an example
  • 1. Fill kettle
  • 2. Boil kettle
  • 3. When kettle boiled pour hot water in cup
  • 4. Add tea bag, milk and sugar
  • 5.Stir
  • We can then use this as the design for our program

19
Your turn
  • Write the Pseudocode for the following
  • A program that asks the user which times table
    they wish to be displayed. The program will then
    display that times table in a list box

20
Structure Diagram
  • Fairly simple, take the tea making example

Making tea
Fill kettle
Boil kettle
Stir
When kettle boiled pour into cup
Add milk, sugar
21
Structure Diagram(with data flow)
Length breadth
Length breadth
area
area
  • Indicates what variables are passed in and out of
    procedures

22
Structure diagram
  • Draw the following structure diagrams(with data
    flow)
  • A program that calculates the area of peoples
    gardens when given the length and breadth in
    metres
  • A program that works out the average test score
    for a pupil from 3 different test scores

23
Software Development Process
  • Implementation This is the process of turning
    the design into a suitable programming language.
    We will use a High Level Language, called Visual
    Basic.
  • Testing A great deal of time is spent on
    testing. A wide range of conditions will be
    tested. Normal, extreme and exceptional testing.

24
Documentation
  • User Guide Details of how to use the program
  • Technical Guide The minimum specifications
    required of the computer you wish to install the
    software on. Will also contain installation
    instructions

25
Maintenance
  • The 7th and last stage of the development process
  • Continuous
  • 3 types of maintenance
  • Corrective
  • Perfective
  • Adaptive

26
Maintenance
  • Corrective
  • Fix bugs that appear when program is in use
  • Company might make downloadable patch available
  • Perfective
  • Adding new features
  • Might mean a new a version of the software is
    created
  • Adaptive
  • When software needs to take account of some
    change in the conditions it operates in
  • E.g. new version of operating system for example
    was designed for Windows XP and adapted to run on
    Windows Vista

27
Order these steps correctly
  • A writing a user guide and technical guide for
    the software
  • B Deciding the game you want to create, and
    what features you want it to have
  • C adapting the game to run on a different type
    of computer
  • D Actually writing the program code
  • E Checking that the program does what it is
    supposed to do, is easy to use, and can be fixed
    if there is a problem
  • F working out the details of what the screens
    will look like, what menus and functions there
    will be, and other detailed aspects of the
    program
  • G Getting users to try out the program to make
    sure it works under most conditions

28
ANALYSIS the user requirements are determined
at this stage
DESIGN Software and Program design are detailed
at this stage
MAINTENANCE-upgrading
SOFTWARE DEVELOPMENT LIFECYCLE
EVALUATION - refinements
IMPLEMENTATION actual program put into operation
DOCUMENTATION technical and user guide drawn up.
TESTING errors and bugs corrected
29
High Level Languages (HLLs)
  • Just like human language, there are many
    different types of programming language
  • Each has been designed to solve a specific type
    of problem
  • Each has its own strengths and weaknesses

30
High Level Languages (HLLs)
  • Visual Basic is an example of a High Level
    Language
  • High Level Languages contain normal words and
    are close to English
  • This makes them relatively easy for us to
    understand
  • However, as we know computers only understand
    binary

31
Low Level Languages
  • Low level languages are closer to the language
    that the computer can understand
  • It is very difficult to track down and fix bugs
    using these languages

32
Machine Code
  • Computers only understand binary, the only input
    a processor will accept is a binary code and it
    will only give this as output, these are known as
    Machine Codes
  • There are a number of problems with Machine Codes
  • They are different from processor to processor
  • Hard for humans to understand and use
  • Difficult to find and fix errors

33
Questions
  • Which type of language (high or low) is easier to
    understand?
  • Which type would be easier to correct if it had a
    mistake in it?
  • Name 2 low level languages
  • Name 2 high level languages
  • Explain the main differences between high and low
    level languages
  • List 2 advantages of high level languages

34
High/Low Level Languages
  • High
  • Visual Basic
  • Pascal
  • Logo
  • Java
  • Low
  • Machine Code
  • Assembler

35
How does a computer understand a HLL?
  • The short answer is it doesnt
  • What could we do if we wanted to communicate with
    a Chinese person who doesnt speak English and we
    dont speak Chinese?
  • Get a translator
  • This is exactly what a computer does
  • Every HLL has a translator to translate it to
    code the computer understands

36
Translators
  • There are 2 different types of translator
  • Compiler and Interpreter
  • Each has strengths and weaknesses

37
Interpreters
  • Take each line one at a time and convert to
    machine code
  • This is the reason that Visual Basic tells you
    when youve made a mistake at the end of each
    line
  • This means when a program is run the line has to
    first be translated and then executed, which
    slows the program down

38
Interpreters
  • The program needs to be translated each time it
    is run so there is no way to speed the process
    up.
  • This means the interpreter and the program must
    be stored after the program is complete
  • Where the program goes the interpreter is needed

39
Compiler
  • Translates the program when it has been completed
  • It takes the whole program and converts it to
    machine code at once
  • This machine code can be kept and run as many
    times as you want
  • Means the program runs faster
  • Only the compiled program needs to be stored

40
Questions
  • Name the two main types of translator programs
  • Which one translates the whole program into
    machine code before it is executed?
  • Which translates the program line by line?
  • Why do machine code programs run more quickly on
    a computer than high level language programs?

41
Text Editors
  • Implementation of a program takes place in a high
    level language(HLL)
  • High level languages are very close to English
    and therefore we can use tools much like those we
    would use when typing an essay e.g. cut and paste
  • HLLs can be typed in a word processing package
    and saved as a text file, ready for translation
    to machine code

42
Scripting Language and Macros
  • This unit is mostly concerned with the process of
    developing stand alone applications in high level
    languages
  • However small programs can be developed within
    some existing application packages
  • These are called macros
  • Macros are time saving programs written in a
    scripting language which can be activated by a
    series of key strokes for repeated use. They will
    only work with an application program, they
    cannot exist alone.
  • They can extend the functionality of an
    application
  • They customise applications

43
Questions
  • What is a macro?
  • What type of language is used to write macros?
  • What are the advantages of using macros?
  • Describe 2 examples where a macro could be useful.

44
Variables(Implementation)
  • We declare variables in our program to hold
    values that might change throughout the execution
    of our program
  • We will be mainly using 3 variable types in this
    course. String (for text), Integer (whole
    numbers) and Single (numbers with fractions)
  • If we declare a variable as a certain type the
    program will expect this type to be used when
    trying to set a value for a variable

45
Variables(Implementation)
  • It is good practice to declare all of the
    variables at the start of the program
  • Dim name as String
  • Dim age as Integer
  • Dim rate_of_pay as Single
  • Dim is short for Dimension

A space in memory
name
age
rate_of_pay
46
Which variable type?
  • 0.456
  • Jones
  • -56
  • 291
  • Mike
  • 17.886
  • 3.14
  • R2D2

47
Which variable type?
  • 0.456 Single
  • Jones String
  • -56 Integer
  • 291 Integer
  • Mike String
  • 17.886 Single
  • 3.14 Single
  • R2D2 String

48
Exercise
  • Which of the following excerpts of code will give
    errors?
  • (a) Dim name as String
  • Name Derek
  • Dim price as Single
  • price Derek
  • Dim price as Integer
  • price 30

49
Formatting Output
  • It is good practice to format your output
    accordingly e.g. if you are outputting a monetary
    value it should look like this 3.90
  • There is a function in VB6 that takes care of
    this for you, cleverly it is called the Format
    function and can be used like this
  • Format(price, currency) this has the effect of
    formatting the variable price so that when it is
    output to the screen it will have a sign added
    automatically

50
Formatting Output
  • Some other examples
  • Format(price, .0) to one decimal place
  • Format(price, .000) to 3 decimal places
  • Format(average, percent) ??
  • Format(time, .00\s)??

51
Naming Conventions
  • Label start with lbl
  • TextBox start with txt
  • Command Button cmd
  • Picture box pic
  • List Box - lst

52
Variable Names
  • Remember that variable names give us an easy way
    to refer to a storage location in memory
  • Rather than using the address
  • Variables will be used in every program
  • In large programs there can be hundreds of
    variables
  • Good variable names make a program more readable

53
Variable Names
  • It is therefore very important and good practice
    to use sensible, meaningful variable names.
    Sometimes this means using multiple words
  • Some no nos
  • Whitespace is not allowed
  • E.g user age
  • Use capitals to de-limit multiple words
  • userAge
  • roomWidth
  • Or use under score
  • User_age
  • Room_width
  • Choose one method and stick to it!

54
Commenting
  • It is good practice to comment your code so that
  • You can understand the program
  • You can see where you left off if you dont get a
    program finished
  • Makes it readable
  • Helps maintenance as often in software companies
    more than one person will work on a program so
    comments help others see what you are trying to
    do more easily.

55
Commenting
  • To comment we simply type an apostrophe () after
    the line of code and anything after it will be
    ignored by the computer e.g.
  • Dim name as String declares a name variable
    with the type string

56
Making Decisions
  • Often the programs we write wont always go
    straight from start to finish
  • In some programs we will want to make decisions
    and based on these decisions the program might
    execute an alternative set of instructions e.g.
  • If condition then
  • Action 1
  • Action 2
  • Else
  • Alternative Action 1
  • End If

57
IF statements
  • The technique we use to make decisions is an IF
    statement
  • IF (userNumber 1) Then
  • lblOutput.Caption You win the car!
  • Else
  • lblOutput.Caption You Win nothing!
  • End If

58
More Complex IF Statements
  • Sometimes a decision is not as straightforward as
    simply IF something True then do something
  • We might need to look at more than one thing
    being true or a combination of true and false
  • We have a set of operators that can be used for
    this

59
Complex IFs
  • For example OAPs to qualify as an OAP, men need
    to be 65 or over and women need to be 60 or over
  • This couldnt be represented with a normal IF
    statement
  • If (sex m) AND (age gt 65) then
  • Print you are an OAP
  • Else
  • If (sex f) AND (age gt 60) then
  • Print You are an OAP
  • Else
  • Print you are not an OAP, YET!
  • End If
  • End If

60
Multiple IFs
  • It is possible that your program will need to
    make more than one decision and we can use
    multiple Ifs to do this e.g
  • If mark gt 70 then grade A
  • If mark gt 60 then grade B
  • If mark gt 50 then grade C
  • Else
  • Grade Fail

61
Multiple IFs
  • In the example on the previous slide, even if the
    mark is greater than 70 the other 2 IF statement
    lines of code will be executed
  • This means the program is executing 2 lines of
    code unnecessarily
  • This is inefficient use of resources(processor
    time/main memory)

62
An efficient alternative
  • A more efficient way to code this would be a CASE
    statement
  • Select CASE mark
  • Case Is gt70
  • Grade A
  • Case Is gt 60
  • Grade B
  • Case Is gt 50
  • Grade C
  • End Select
  • Select CASE is more efficient because if mark is
    75 the grade will be set to A and the remaining
    Case Is lines are ignored, therefore not
    executing unnecessary code

63
InputBoxes
  • So far we have used text boxes to get the user
    input. We are now going to use a special code
    word in Visual Basic, InputBox
  • When an InputBox is used your program will open a
    new window with a prompt for the user to enter
    something

64
InputBoxes
  • InputBoxes are used in the following way
  • Variable_name InputBox (Prompt to the user,
    Title of InputBox)
  • Or a real example
  • UserName InputBox(Enter your name, Enter
    Name)

65
InputBoxes
  • This code
  • UserName InputBox(Enter your name, Enter
    Name)
  • Would produce the following window when the
    program is run

66
MessageBoxes
  • InputBoxes are a nice way to collect input to
    your program as a lot of the work is done for
    you.
  • There is a similar special word we can use for
    output, MsgBox
  • Used like this
  • MsgBox (Thanks for using my program)

67
MessageBoxes
  • This code MsgBox (Thanks for using my
    program)
  • Produces the following

68
Fixed Loops
  • So far, every program you have written starts at
    the beginning and executes each line till it
    reaches the end and then stops
  • To repeat a program you need to run it again
  • It is often useful to be able to repeat a number
    of lines of a program

69
Fixed Loops
  • If we know how many times we want to repeat
    something we can use a fixed loop
  • For counter 1 to 10
  • Form.Print Mr McAlpine is the best!
  • Next
  • Will print the statement to the form 10 times

70
Loops using a variable
  • If we want a loop that can be repeated a variable
    number of times we can get the user to input the
    value for the loop to stop
  • For counter 1 to user_input
  • Print this is an example of a variable loop
  • Next

71
ForNext other ways to control the loop length
  • We can control the loop length using a command
    called Step
  • For counter 1 to 20 Step 2
  • This would have the effect of adding 2 to the
    counter each time round the loop rather than the
    default 1
  • We can put whatever number we like after the
    step, depending on how we want the loop to
    operate
  • For counter 10 to 1 Step -1
  • Would have the effect of going down from 10 to 1

72
Questions
  • Write the Visual BASIC coding of a For..Next loop
    to produce each of the following lists of numbers
  • 3,6,9,12,15,18..33,36
  • 0,9,18,27..99
  • 10,9,8,7,6,5,4,3,2,1,0
  • 0,0.75,1.5,2.25,3,3.75,4.5
  • 50,40,30,20,10,0,-10,-20,-30,-40,-50
  • 1,4,9,16,25,36,49,64(hint these are all numbers
    squared)

73
More Loops
  • So far the loops we have used have gone for a set
    or fixed number of times depending on us setting
    it up or the user saying how long they want the
    loop to be
  • There is another kind of loop that can be used
    when we are unsure of when we want a loop to end
  • Conditional Loop

74
Do..Loop Until
  • One type of VB6 loop we can use when we are
    unsure of the number of times a loop will be
    repeated is called a Do..Loop Until, it looks
    like this
  • Do
  • Lines of code to be repeated
  • Loop Until condition

75
Do..Loop Until
  • Here is a real example of this kind of loop
  • Do
  • userInput InputBox (What is 22?)
  • Loop Until userInput 4
  • This will keep asking the user the question until
    they enter 4(the correct answer)

76
WhileWend Loop
  • A While loop is also a conditional loop
  • While ( user_password ltgt p4w0rd)
  • user_passwordInputBox(Enter password)
  • Wend
  • This loop will continue whilst the users entry is
    NOT p4w0rd

77
What kind of Loop?
  • Program needs to take in a list of ten names
  • Program needs to keep going until the user enters
    the word end
  • Program continues until user enters a 4 digit pin
  • Program needs to take in four different pieces of
    information from the user

78
Input Validation
  • There is a saying in computing which goes
  • Garbage In, Garbage Out (GIGO)

79
(No Transcript)
80
Input Validation
  • It is common for the companies who do things like
    this to blame it on computer error
  • More often these type of errors occur because the
    program has been fed invalid data

Wrong data in
Wrong data out
Program
81
Input Validation
  • If we design our program properly we should be
    able to prevent or at least restrict the amount
    of wrong data our user is allowed to enter
  • An example we have designed a program that
    allows teachers to enter their students
    percentages and it calculates a grade

82
Input Validation
  • So the teacher is entering the percentages. They
    want to enter 59 but are in a hurry and enter
    559.
  • This would most likely give the student an A
    when they shouldve in fact got a B
  • Garbage In, Garbage Out!
  • This could be prevented by making it impossible
    to enter a score of more than 100

83
Input Validation
  • A score of over 100 could be described as Invalid
    in this sense
  • Invalid data, is data which makes no sense
  • To prevent invalid data being entered we can
    include our code for data input in a conditional
    loop that will only stop when valid data is
    entered

84
Invalid Data
  • A program asks a user to enter a date in
    day/month/year format. Give an example of an
    entry that would be considered invalid and also a
    valid entry
  • A program asks a user to enter a 5 digit number,
    give an example of an invalid entry and a valid
    entry.

85
Input Validation
  • Note that Input Validation does not stop mistakes
    from occurring it simply stops invalid data being
    entered.
  • For example it would stop a percentage of 105
    being entered but if someone entered 59 instead
    of 49, validation does not pick up on this
  • The process of catching erroneous data is called
    verification, which is outside the scope of this
    course

86
Input Validation
  • The process of input validation always follows a
    standard pattern
  • Standard patterns save programmers time when
    programming
  • A pattern like this is called a standard algorithm

87
Input Validation
  • Here is a simple version of the standard
    algorithm for input validation
  • Do
  • Prompt user for valid input
  • If input is invalid, warn user
  • Loop until data is valid

88
Other Standard Algorithms
  • Input Validation is an example of a Standard
    Algorithm
  • There are 4 others that you need to know about
  • Finding a minimum/maximum, Counting Occurrences
    and Linear Search

89
Standard Algorithms
  • The pattern for Input validation is the same in
    all scenarios
  • This saves programmers time when designing
    programs
  • There are many other instances of these patterns
    that are re-useable
  • They are called STANDARD ALGORITHMS

90
Finding Minimum/Maximum
  • These algorithms search lists of numbers and
    return the value of the minimum/maximum
  • E.g in the following list
  • 14, 67, 24, 2, 69, 9, 100, 101
  • Minimum?
  • Maximum?

91
Finding Min
  • Will usually be used in conjunction with an array
  • Set min first element in array
  • For length of array
  • If current array element lt min then
  • Min current array element
  • Next
  • Print min

92
Finding Max
  • Will usually be used in conjunction with an array
  • Set max first element in array
  • For length of array
  • If current array element gt max then
  • Max current array element
  • Next
  • Print min

93
Counting Occurrences
  • Works its way through a list of numbers, as it
    does, it counts the amount of times a certain
    value appears
  • E.g. how many times does 3 appear here?
  • 4, 7, 3, 8, 6, 3, 9, 0, 3, 5

94
Counting Occurrences
  • Usually involves using an array
  • To_find Dave
  • For length of array
  • If current array element to_find
  • Counter counter 1
  • Next
  • Print Counter

95
Linear Search
  • Searches through a list looking for a particular
    item and returns where in the list the item
    appears
  • e.g. search for blue
  • Red, green, yellow, orange, blue, pink
  • 5 would be returned as blue is the 5th item in
    the list

96
Linear Search
  • Usually used along with an array
  • Name InputBox Enter a name to be found
  • For counter 0 to length of array
  • If namearray(counter) Name
  • Display Name found at counter
  • End If
  • Next

97
Which standard algorithm would we use to solve
these problems?
  • Search through a list of names to find at what
    place the name Steve appears
  • Make sure the user enters a number between 1 and
    10
  • Find the month in a list with the lowest rainfall
  • Counting the number of times Rangers have won the
    league from a list of league winners

98
Questions
  • Which standard algorithm would be used by the
    national census to
  • Find out how many people called Mary live in the
    UK
  • Find out the oldest person living in the UK
  • Discover whether or not there was an individual
    living in the UK call Stan D. Ard-al-Gorithm

99
Pre-Defined Functions
  • These carry out standard operations that are
    commonly used
  • They exist for strings (text) and numbers
    (Integers)

100
Pre-defined String Functions
  • UCase (string) capitalises the string
  • LCase (STRING) puts string to lower case
  • Len (string) returns the length of the string
  • Mid(string, start point, lengthrequired) returns
    a section of the string starting at the character
    specified by the start point and the length
    specified by the lengthrequired

101
SubStrings
  • Essentially taking a chunk out of a string to use
    for something else like generating a password or
    to look for a pattern in a string
  • Using
  • Mid(string to be used, start position, number of
    letters in the substring)

102
Concatenation
  • Sometimes we will want to output multiple values
    using a single line of code e.g
  • MsgBox(Your total bill is totalCost)
  • Or
  • MsgBox(Customer Name name VbCrlf
    Customer Address address)
  • Using the sign is called Concatenation
  • It can be used as many times as necessary to get
    your output looking like you want it

103
Concatentation
  • Remember though that there is a Format function
    so
  • Something like
  • MsgBox(Format(price, Currency))
  • Will have the same effect as
  • MsgBox ( price)

104
Questions
  • Match these descriptions to the pre-defined
    function
  • Description Pre-defined function
  • Returns the ASCII code of character Mid
  • Selects a group of characters out of a
    string Asc
  • Turns any character into upper case LCase
  • Takes an ASCII code and returns the character
    it UCase
  • represents
  • Changes any character to lower case Len
  • Counts the number of characters in a
    string Chr

105
Questions Continued
  • If sentence What is 25 times 8?), what would
    be the output from
  • A) Mid(sentence,1,1)
  • B) Mid(sentence,1,4)
  • C) Mid(sentence,9,2)
  • D) Mid(sentence,19,1)

106
Pre-Defined Numeric Functions
  • INT(variable containing a fraction) would remove
    the fractional part, leaving the whole number
  • ROUND(variable to be rounded) rounds the number
    to the NEAREST whole number
  • SQR(variable) gives the square root of any number

107
User Defined Functions
  • We can create functions of our own e.g
  • Function calc_area(length as single, breadth as
    single) as single
  • Dim area as single
  • Area length breadth
  • Calc_area Area
  • End Function
  • We can then use the function as follows
  • Private sub cmd_click()
  • Dim length as single
  • Dim breadth as single
  • Dim area as single
  • Area calc_area(length, breadth)

108
Arrays
  • Arrays are useful for times when we need to store
    lists of related data
  • For example 6 test marks for a pupil, we would
    normally do this
  • Dim mark1 as integer
  • Dim mark2 as integer
  • Dim mark3 as integer
  • Dim mark4 as integer
  • Dim mark5 as integer
  • Dim mark6 as integer

109
Arrays
  • This would give us 6 independent variables in
    memory

110
Arrays
  • However if we just use this command
  • Dim mark(5) as integer
  • We define an array where each variable is
    referred to by an index e.g. 0,1,2,3

111
Arrays
  • An array is very useful as the program can refer
    to the whole array at once or any single element
  • Arrays would normally be used in conjunction with
    a loop

112
Testing
  • Any product created will go through rigorous
    testing
  • A wide range of conditions will be used e.g. not
    only expected inputs in the case of a program
  • These will be planned at the design stage
  • Testing will be systematic and comprehensive
  • Systematic means the testing is planned and not
    just random tests
  • Comprehensive means every aspect is tested

Testing can only prove the presence of bugs, not
their absence. Testing finds bugs, de-bugging
removes those bugs
113
Normal Testing
  • Make sure the program does what it should when
    being used normally
  • A program expects a number to be entered between
    0 AND 40
  • Normal testing would test that the program did
    what it should for numbers 1-39

114
Extreme/Boundary testing
  • Making sure the program can handle values at the
    extreme or boundary of what is considered normal.
  • Using our 0 to 40 program
  • Extreme tests would be -1, 0, 40, 41

115
Exceptional testing
  • Making sure the program can handle situations or
    inputs that are unexpected or that the program is
    not designed for
  • Using our 0-40 program
  • Things like 3000000, y , n , -45690, hello

116
What kind of testing
  • A) program looking for a persons age and the
    test data used is hello, 1000000, steve,
    oioi70780
  • B) program looking for a 4 digit pin code and the
    data used is 0000, 0001, 9999
  • C) program looking for the price of a slab 0.50,
    1.23, 2.45, 5.60

117
Testing and Robustness
  • Testing all conditions provides useful evidence
    about he robustness of the software
  • Robustness is the ability of the program to cope
    with erroneous/unexpected data

118
Testing
  • Testing is carried out by Independent Test teams
  • Other programmers from within the organisation
  • Or perhaps contractors
  • Or potential clients
  • Or combination of all of the above
  • Testing is carried out at various stages

119
Acceptance Testing
  • Acceptance testing is sometimes called Beta
    testing
  • Carried out on the premises where the software
    will be used, by the people who will use it
  • Given unrestricted access
  • Allowed to enter unpredictable input to test the
    behaviour of the program

120
Exhaustive Testing
  • Testing functionality with all possible valid and
    invalid data
  • Is this possible?
  • So how much is enough?
  • How important is the project?

121
Documentation
  • After testing has been completed we move onto
    stage 5 of the development process
    Documentation
  • Any product you buy, software or hardware will
    come with a User Guide to tell you how to use the
    product
  • This may also contain a tutorial taking you
    through the use of the product step by step
  • Becoming more prevalent to use an electronic
    format
  • More eco-friendly but can also be updated with
    the software

122
Documentation
  • As well as the user guide for the software, there
    will also be a Technical Guide of some sort
  • Usually this is of no interest to most users, but
    will contain information about the specification
    of computer required
  • E.g. RAM, how fast a processor and which
    Operating System the computer needs
  • Will also contain instructions on installation of
    the software
  • Might also contain information on trouble shooting

123
Evaluation
  • Stage 6 and the final stage before the product is
    distributed
  • Involves reviewing the software to see if it is
    of the quality required
  • We will look at three headings
  • Fitness for Purpose
  • User Interface
  • Readability

124
Evaluation
  • User Interface
  • Is program easy to use?
  • Is it clear what each menu, command and button is
    for?
  • Could it be improved in any way?

125
Evaluation
  • Fitness for Purpose
  • Does software do as it should under all
    reasonable conditions?
  • Check against the program specification to make
    sure (analysis stage)
  • Look at test results and making sure the program
    is free of bugs

126
Evaluation
  • Readability
  • No direct concern of the user
  • Important for other programs to understand how
    the program works
  • Is it possible for another programmer to read and
    understand the code
  • Needs to be if there will be updates performed at
    a later date

127
Evaluation(Higher)
  • The following questions will be asked
  • Is the program robust?
  • Is the program reliable?
  • Is the program reliable?
  • Is the program portable?
  • Is the program efficient?
  • Is the program maintainable?
  • These are expanded in the notes

128
Evaluation
  • What 3 criteria will be used for evaluating
    software in this unit(Int 2)?
  • What is the relationship between pseudocode and a
    structure diagram?
  • Name 2 items of documentation usually provided
    with a software package, and describe what you
    would expect each one to contain.
  • What 3 types of testing should be applied to any
    software?
  • Describe 2 examples of maintenance that would be
    required on a game program.

129
Scope
  • Variables can have 2 types of scope
  • GLOBAL and LOCAL
  • Global variables are created outside any subs,
    functions or procedures and can be used/seen by
    all subs/functions/procedures
  • Local variables are created inside subs and can
    only be seen/used within that sub

130
Modularity
  • Scope gives programmers freedom to create modules
    without worrying that they are creating variables
    in their module that conflict with the variables
    created by the other programmers
  • E.g. we are creating a school management program.
    I am creating the module for pupils and I use the
    variable firstName. You are creating the module
    for the teachers and use a variable called
    firstName. As long as these variables are LOCAL
    to my sub, e.g. created within my sub there will
    be no conflict

131
Parameter Passing
  • A parameter is just a variable being passed into
    a subroutine
  • Very important programming concept
  • Ensures variables dont interfere with each other
  • Keeps programs reliable

132
Parameter Passing
  • In real programming situations, several
    programmers are involved in the creation of the
    program
  • The each create sub procedures
  • Private sub valid_age(byval age as integer)

133
Parameter Passing
  • Private sub valid_age(byval age as integer)
  • To execute this sub procedure we would put the
    line
  • Call valid_age(person_age)
  • Note that the parameter passed does not match the
    variable, this is ok and will still work. As long
    as person_age is an integer
  • This allows programmers to write procedures and
    not worry about what other programmers are
    calling variables

134
ByVal
  • Used if you only need to use the value of the
    variable
  • You wont be able to change the value of the
    variable
  • You send a copy of it that is discarded after use
  • Like giving someone a photocopy, they can write
    on it etc and throw it away after use, you keep
    the original

135
ByRef
  • Used if you need to change the value of the
    variable
  • They are passed in, updated and passed out for
    future use
  • Like giving someone your master copy, if they
    change it and give you it back, the changes are
    permanent

136
Evidence
Int 2
Higher
  • Task using Select Case (P20) Section 2
  • Lucky Prize Draw P8 Section 4
  • Book Orders Program Evaluation of Book Orders P
    24 Section 6 Testing
  • Task 7.7.2 and 7.7.3 on page 17 section 7
  • Task 7.8.2 on P23 section 7 User Guide
    Analysis Design
  • Belindas Slab Calculator(P17)
  • Blob diagram, Form Design, Pseudocode, Code
    listing, testing, User Guide
  • Colour Changer(p59)
  • Blob Diagram, Form Design, Pseudocode, Code
    listing, User Guide
  • Times table program(P73)
  • Code, UserGuide, Testing
  • Any 2 of the following code listings
  • Age Program, PIN program, Year Program (all on
    P94)
Write a Comment
User Comments (0)
About PowerShow.com