+ All Categories
Home > Documents > Software development slides

Software development slides

Date post: 02-Nov-2014
Category:
Upload: iarthur
View: 247 times
Download: 0 times
Share this document with a friend
Description:
 
Popular Tags:
105
National 5 Computer Science Software Development Faculty of ICT
Transcript

National 5 Computer Science

Software Development

Faculty of ICT

Aims - Systems Lesson 1

To introduce Course Structure Issue Jotters/Resources Rules 5 Box Diagram Discuss Hardware/Software/Input/Output

Device Create Folder label

Class Rules

1. Get to class on time and line up quietly with jacket off

2. Come into class in an orderly fashion and take out folder

3. No chewing gum!!!!!!!!!!!!!!!!!!!!!!!!

4. Always sit at the “Theory desks” to see lesson aims

5. Take out pencil/pen

6. No talking when I am talking!!!!!!!!!!!!!!!!!!!!!!!!

7. Hands up when answering

8. Treat others in class with respect

9. Follow all instructions

Course Outline

Mandatory Units Software Design and Development (3 outcomes) Information Systems Design and Development (2

outcomes) Evidence should be gathered throughout the

year to meet the 5 outcomes Assessment

Written Exam 90 marks Coursework in class 60 marks

Folders to Create

S4 Computer Science Software Development Info Systems Design and Development

5 Box Diagram

Aims - Systems Lesson 2

Last Lesson 5 Box Diagram Hardware/Software/

Input/Output Device Folder label

Today Main Memory

RAM ROM

Create poster on Hardware/Software/RAM and ROM

Main Memory

Main Memory can either be RAM or ROM

Random Access Memory RAM holds all the data currently in use by

the Computer System Volatile = the contents are lost when the

Computer is Switched off Processor can read and write to RAM at

high speed Typically 4-8Gb in a Desktop

Main Memory

Read Only Memory Data is stored permanently and cannot be

changed Data is written to ROM at manufacture

Lesson Starter

1. Give 3 examples of Input Devices

2. What does RAM and ROM stand for?

3. What is the difference between RAM and ROM?

Aims - Systems Lesson 3

Last Lesson Main Memory

RAM ROM

Hardware Poster

Today The Processor

ALU/Control Unit Find 4 devices and

take a note of their Processor Speed

The Processor

The processor or Central Processing Unit is the brain of the computer where all the decision making, calculations etc are carried out

We send instructions (programs) to the processor to get the computer to do something

Processor speed (clock speed) is measure in how many millions of instructions the processor can process per second (typically 3-4Ghz)

Dual Core = 2 processors Quad Core = 4 processors

Parts of the Processor Control Unit

Makes sure programs are processed in the correct order

Is responsible for bringing data from RAM into the processor

Arithmetic Logic Unit Performs calculations Makes decisions using AND, OR, NOT

and IF

Registers

Registers are storage locations inside the processor

Memory Address Register These Registers store the addresses of where the

data came from in RAM Memory Data Register

These store the data that has been read from RAM or going to be written back to RAM

Backing Storage

A Backing Storage device is a piece of hardware that is used to store data permanently when the computer is switched off

Magnetic Hard Disk (500Gb – 1TB) Magnetic Tape (500TB +) USB Memory Stick (2GB- 64Gb)

Optical CDROM/R/RW (750Mb) ROM = written at manufacture Recordable = store to once then ROM Rewriteable = save over the top of items DVDROM/R/RW (4.7Gb)

Sequential Access = This is Backing Storage where you access data in a particular order

Direct Access = This Backing Storage allows you to access data in any order

Interface An interface is a piece of hardware positioned

between a peripheral and the CPU. The interface compensates for any differences

USB Firewire Functions

The interface compensates for the difference in speed

Analogue to Digital Conversion (Microphone – Processor)

Interface may temporarily store data, for example, the buffer in the printer

Aims - Systems Lesson 4

Last Lesson The Processor ALU/Control Unit

Today The Processor

Registers Address Bus Revision Questions

Processor

Buses

Buses are wires or channels that carry data to and from the Processor and Main Memory

Address Bus Carries Address information from RAM into the

Memory Address Register in the Processor 1 way The larger the address bus the more addresses

you can access

Buses

Data Bus Carries data to and from RAM into the Memory

Data Register 2 way The number of wires in the Data Bus determines

how much data can flow per clock cycle The width of the Data Bus directly affects

performance

Aims - Systems Lesson 5

Last Lesson The Processor

Registers Address Bus

Today Data Bus Interfaces

Aims - Systems Lesson 6

Last Lesson Data Bus Interfaces

Today Data Storage Storage Units Storage Calculations

Data Storage

Numbers, Text, Images, Sound and video are all stored as a series of ons and offs (1s and 0s) inside the computer system.

These series of 1s and 0s are made up of pulses of electricity from 1 volt to 5 volts

Storage Capacities

0 or 1 = 1 bit

8 bits = 1 byte

1024 bytes = 1 Kilobyte

1024 Kilobytes = 1 Megabyte

1024 Megabytes = 1 Gigabyte

1024 Gigabytes = 1 Terabyte

Storage of Music Files

William has an Ipod with a capacity of 1Gigabyte (1Gb). If a song requires 2 Megabytes of storage space, how many songs can you store on the Ipod

1Gb = 1024Mb Ipod = 1024Mb Song = 2 Megabytes Number of songs = 1024

2

= 512 songs

Storage of Music Files

Drew has an Ipad with a capacity of 32Gigabyte. If an image requires 512 Kilobytes of storage space, how many images can you store on the Ipad?

Lesson Starter

How many 4Mb images can you store on an 8Gb Iphone?

Aims - Systems Lesson 7

Last Lesson Data Storage Storage Units Storage Calculations

Today Representing positive

whole numbers Decimal to Binary Binary to Decimal

Decimal Counting System

When we represent numbers we use the decimal counting system, for example

123,000

100,000 10,000 1,000 100 10 1

1 2 3 0 0 0 Since the computer is 2 state, the binary counting

system goes up by the power 2, rather than 10 i.e

256 128 64 32 16 8 4 2 1

How Positive Whole Numbers are Stored

34

128 64 32 16 8 4 2 1

0 0 1 0 0 0 1 0

= 32 + 2 134

128 64 32 16 8 4 2 1

1 0 0 0 0 1 1 0

= 128 + 4 + 2

Binary back to Decimal

1011 0011

128 64 32 16 8 4 2 1

1 0 1 1 0 0 1 1

= 128 + 32 + 16 + 2 + 1

=179

Binary Conversion

Convert the following Decimal Numbers to Binary

31 67 105

Convert the following Binary Numbers to Decimal

1011 0111

0011 0110

0101 1011

Aims - Systems Lesson 8

Last Lesson Representing positive

whole numbers Decimal to Binary Binary to Decimal

Today Representing decimal

numbers using Floating Point

Representing Non Whole Numbers

How do we represent the number 128.75 in binary?

128 + 0.5 + 0.25 = 128.75

128 64 32 16 8 4 2 1 0.5 0.25 0.125 0.0625

1 0 0 0 0 0 0 0 1 1 0 0

Mantissa and Exponent

Mantissa

Exponent

8

8 4 2 1

1 0 0 0

128 64 32 16 8 4 2 1 0.5 0.25 0.125 0.0625

1 0 0 0 0 0 0 0 1 1 0 0

1 0 0 0 0 0 0 0 1 1 0 0

Mantissa

Exponent

6

8 4 2 1

0 1 1 0

1 0 0 1 1 0 0 0 1 0

1 0 0 1 1 0 0 0 1 0

How do we represent the number 38.125 using floating point

32 16 8 4 2 1 0.5 0.25 0.125 0.0625

Representing Non Whole Numbers

Mantissa relates to the precision of the number you can represent i.e 34.44454321

Exponent relates to the position of the decimal point and the range of the number

8 4 2 1 0.5 0.25 0.125 0.075 0.0375 0.01875 0.009375

Aims - Systems Lesson 9

Last Lesson Representing decimal

numbers using Floating Point

Today Representing

characters ASCII Unicode

How are Characters Represented ASCII

American Standard Code for Information Interchange

Each key on the keyboard is converted into a binary code using 7 bits

Using 7 bits i.e 2 = 128 characters can be represented

Character Set A list of all the characters which

the computer can process Control Characters

Codes 0 to 31 are non printable characters, for example tab, return, alt

7

Character Binary Decimal

tab 000 1001 9

return 000 1101 13

space 010 0000 32

! 010 0001 33

‘ 010 0010 34

1 011 0001 49

A 100 0001 65

a 110 0001 97

Unicode Unicode is coding system which uses 16 bits per

character This allows 2 ^ characters 65,536 characters can be represented Adv

Allows you to represent characters from different languages

Dis Takes up more than double the space to store

each character

16

Binary Message

1010100 1001000 1001001 1010011

0100000 1010111 1000101 1000001

1010100 1001000 1000101 1010010

0100000 1001001 1010011 0100000

1001000 1001111 1010010 1010010

1001001 1000010 1001100 1000101

Lesson Starter

1. How many characters can be represented in ASCII?

2. Give 1 advantage and 1 disadvantage of Unicode over ASCII

3. Convert 129 to binary

4. What 2 items are stored in Floating Point?

Aims - Systems Lesson 10

Last Lesson Representing

characters ASCII Unicode

Today Representing Bitmap

images Pixels and Resolution

BIT Map GraphicsSCREEN MEMORY

PIXEL

MEMORY REQUIRED

8 BITS X 8 BITS = 64 BITS

= 8 BYTES

Bit Map = the graphic is made up from a series of pixels

Pixels/Resolution

Pixel Stands for Picture Element A pixel is a dot on the screen. It is a graphic

segmented up into its simplest form

Graphics Resolution

The more pixels there are per inch, the finer the detail of the image

800 x 600 pixels lower quality than 1024 x 768

As the number of pixels increases so does the storage space required

Pixel Pattern using 8x8 grid

Pixel Pattern using 16x16 grid

Aims - Systems Lesson 11

Last Lesson Representing Bitmap

images Pixels and Resolution

Today Bitmap Calculations Vector Images Revision on Systems

theory for end of Unit Test

Bitmap Calculations

I have a black and white image that is 400 pixels by 200 pixels. Calculate the storage requirements of this image to the nearest kb

I have a black and white image that is 600 pixels by 500 pixels. Calculate the storage requirements of this image to the nearest kb

I have a black and white image that is 4 inches by 3 inches with a Resolution of 400dpi. Calculate the storage requirements of this image to the nearest kb

Bitmap Graphics

In a Bitmap package, each pixel is converted into a series of on and offs 1/0.

Images cannot overlap, the one on top replaces the pixels below

You can edit each individual pixel, for example, red eye removal

Gets very pixelated if you scale it up

Vector Graphics

In a Vector graphics package , the image is made up of shapes layered on top of each other

The Object attributes are stored Shape = circle, startX,

startY, endX, endY, circle colour, line thickness

Aims - Systems Lesson 12

Last Lesson Representing Bitmap

images Pixels and Resolution Bitmap Calculations Vector Images

Today Colour Depth Compression

Bit Depth (Colour Depth)

The number of colours you use per pixel The lower the bit depth = the less colours you can

represent per pixel, this would make the image poorer quality

Reducing the colour depth reduces the file size of the Bitmap image

The number of bits used to represent colours in the graphic

1 bit = black or white 2 bits = 4 colours 3 bits = 8 colours 8 bits = 256 colours 16 bits = 65,536 colours True colour 24 bits = 16,777,216 colours this is true colour

Compression RAW

This is uncompressed data Compression

Where you reduce the file size of an image/ audio file etc The file will take up less space on Backing Storage, upload and

download faster but some of the quality may be lost Lossy

Compression where some of the original data is lost e.g a JPEG Lossless

Compression where the file size is reduced but none of the data is lost, e.g GIF

Quiz1. Which bus is unidirectional? (1)

2. List the 3 parts of the processor (3)

3. What is the difference between RAM and ROM? (1)

4. Convert 99 to binary (1)

5. What is the difference between a Bitmap image and a Vector image? (1)

6. How many bits are used per character in ASCII and Unicode? (2)

7. What is the bitdepth of the image if it is in 65,536 colours? (1)

8. I have an image that is 700 pixels by 400 pixels in True Colour. Calculate the storage requirements of the image (2)

9. What is the difference between Lossy and Lossless compression? (2)

10. When storing a real number using Floating Point, what 2 items are stored? (2)

Aims - Systems Lesson 13

Last Lesson Colour Depth Compression

Today File Formats Audio Sampling

Audio Sampling

Standard File Formats A Standard File Format is a file format that will open up in many different

programs Text

TXT = the text is stored but none of the formatting is store Rich Text Format = the text and the formatting is stores, e.g. font style, size etc

Audio MP3/WAV

Image GIF /PNG (lossless) JPEG (lossy) Bitmap = stores the colour for each pixel = very large file sizes

Video AVI/MOV/MPEG4

PDF = an Adobe file format for sharing documents. You cannot edit the text in a PDF, only view it

Aims - Systems Lesson 12

Last Lesson Bitmap Calculations Vector Images

Today Systems End of Unit

Test

Aims – Software Development Lesson 1

Today Variables Variable types Creating Variables Assigning Data to Variables

Variables A variable is an item of data that is given a name and data type

and is stored in the computers memory for later use in a program

Variables can be used to store a variety of different types of data

Variable Types String = storing text e.g. “Mr HRH” or 01698_420437 Integers = whole numbers e.g. 232 Single = non whole (real) numbers e.g. 34.565 Booleans = storing a yes/no (true/false) value Characters = stores a single Character e.g. A

Assigning Data to Variables

Creating Variables Dim username as string (This will set up a

variable called username to store text) Dim height as single (This will set up a variable

called height to store a decimal number) Assigning Data to Variables

username = inputbox(“Please enter your username”) – This will bring up an input box asking the user to enter a value and will store it in the variable “username”

Lesson Starter

1. What is a variable?

2. Give 3 different variable types

Aims – Software Development Lesson 2

Last Lesson Variables Variable types Creating Variables Assigning Data to

Variables

Today Arithmetic Operators String Manipulation

Arithmetic Operators

Remember when you are assigning data to

variables you start with the variable name you are

writing to first

area = length * breadth

area = 3.14 * (radius * radius)

answer = numberone / numbertwo

answer = numberone ^ 2

String Manipulation

Concatenation Joining together strings username = forename & surname

Substrings Username = left(forename, 3) & right(surname,3) If your forename = freddie and surname =

mercury this would give you freury Left and Right are predefined functions

Lesson Starter

1. I have the variables area, length and breadth. Write the code to calculate the area, using the other variables

2. I have the variables username, firstname and surname. Write the code that would add the first 4 characters from firstname to the last 4 characters in surname, putting this into the variable username

3. What is meant by string concatenation?

Aims – Software Development Lesson 3

Last Lesson Arithmetic Operators String Manipulation

Today Conditional

Statements Logical Operators

Conditional Statements

We use Conditional Statements in programming to make decisions

If statements

If userage < 17 then

picDisplay.print “Cannot Drive”

Else

picDisplay.print “Can Drive”

End if

Logical Operators Using AND, OR and Not as part of decision statements AND = when both parts of the condition must be met for the outcome to

happenIf firstname = “Henry” AND surname = “Haggarty” then

outcome = “legend”

End if OR = when 1 part of the condition must be met for the outcome to

happenIf team = “Celtic” OR team = “Rangers” then

supporter = “idiot”

End if

Aims – Software Development Lesson 4

Last Lesson Conditional

Statements Logical Operators

Today Loops

Fixed Conditional

Loops A Loop is used to repeat instructions Fixed Loop

A fixed loop repeats the code a set number of times

For num = 1 to 10

picDisplay.print “I must not swear”

Next num

Conditional Loops

Input Validation is a Standard Algorithm that is used to ensure the data entered is within a particular range

1.1 Loop while the number is less than 1 or more than 20

Do while entry < 1 or entry > 20

1.2 Ask the user to enter again

Entry = inputbox(“This is not valid, please enter again”

1.3 Close validation

loop

Nested Loop

A loop inside a loopFor num = 1 to 5

rating(num) = inputbox(“Enter movie rating”)

Do while rating(num) < 0 or rating(num) > 5

rating(num) = inputbox(“Not valid”)

Loop

Next num

Conditional Loops

Loop Until

‘1.1 Open conditional loop

Do

‘1.2 Ask user to enter question

question = inputbox(“Enter question”)

‘1.3 Loop until they say please

Loop until question = “crisps please”

Aims – Software Development Lesson 6

Last Lesson Nested Loops Input Validation

Today Predefined Functions 1 Dimensional Arrays

Testing When you test your program you should use 3

types of test data Example = this program wants you to enter the

first number in the National Lottery (1 to 49) Normal = data within the range (30 or 25 or 3) Extreme = data at the boundaries of the normal

range (1 or 49) Exceptional = data outside the normal range (50,

231 etc)

Readability of Code Someone else looking at or editing your code will

understand it better if you do the following Internal Commentary

Each line of code should have a clear comment 1.1. Ask the user for this firstname firstname = inputbox(“Please enter your first name”)

Meaningful Variable Names Dim username as string NOT – dim u as string This helps you identify exactly what you are storing in your

program

Readability of Code

IndentationFor loopcounter = 1 to 5

picDisplay.print “Hello World”

Next loopcounter

If surname = “Arthur” then

picDisplay.print “Hello Mr Arthur”

End if The start and end of your loops or If statements

should be aligned vertically so you can see where they start and end

Design Notations

In the Design phase the problem is broken down into chunks

The solution to the problem is called the Algorithm

Stepwise Refinement = breaking the problem down into smaller and smaller steps Graphical Design Notations Pseudocode

Text Based Design Notation

Pseudocode Where the stages of the program are broken

down and written in English steps

Lesson Starter

1. Give 3 ways that you can improve the Readability of a program

2. I write a program to calculate how many yawns Jannat has per day. The program should take in a value between 0 and 40. Give 3 tests you could carry out on this program, listing the test data

3. What design notation do you currently use to break problems down into simpler steps

Graphical Design Notations

Flow Charts These use different shaped

boxes to represent programming elements Diamonds = if statements Rounded rectangles = loops Rectangles = calculations

Case Diagram This gives a quick overview of how a

program or system works This is a Case Diagram for a Customer

Order System

Activity Diagrams More complex flow chart B = start or end of an activity Black circle represent the final state

Predefined Functions This is a piece of code that has been prewritten and

you refer to it using a keyword Predefined functions only return 1 value Examples ucase (makes all the characters capital) round (this rounds the decimal number to the nearest

whole number) format(depth,”##.00”) username = left(firstname,3) – This takes the first 3

characters from the variable username

Aims – Software Development Lesson 7

Last Lesson Predefined Functions 1 Dimensional Arrays

Today Filling Arrays with For

Loops Testing

1 Dimensional Arrays Where you store a list of data of the same data type Dim username(100) as string This would set up an array to store 100 usernames Each element of the array is identified by the variable

name and index number username(0) = “arod” username(1) = “jdog” username(2) = “eman”

Option Base 1 This makes the array start at index 1

Arrays

Filling Arrays

For num = 1 to 100

Username(num) = inputbox(“Enter username”)

Next num

Displaying Arrays

For num = 1 to 100

picDisplay.print Username(num)

Next num

Lesson Starter

Lesson Starter

Errors in Code Syntax Error

An error in the sequence of characters in your code picDisplay.pritn (“Hello World”)

Execution Error An error that prevents a program from running for example,

trying to assign to a variable that has not been declared Logic Error

An error in the design of the program that will result in the wrong answer or output

If age > 60 or age < 100 then

picDisplay.print “Pensioner”

Aims – Software Development Lesson 8

Last Lesson Filling Arrays with For

Loops Testing

Today Errors in Code Readability

High Level Languages

A High Level Language is a programming language that uses everyday words

Features English like words Build in functions like left, right, mid, ucase Must be translated to machine code Portable - Can be run on different platforms

picDisplay.print “HRH is a legend”

Low Level Language Machine Code

Machine Code is the only language a computer can process

101010101 It is an impossible language to program in

and errors would be inevitable

Translators All programs written in a

High Level Language must be translated to Machine Code

Interpreters Translates and executes the

program one line at a time Errors are highlighted at

each line making them easier to identify

Interpreter is loaded into RAM during translation

Compilers Translates the High

Level Language (Source Code) into Machine Code (Object Code) in one operation

You can run the Object Code without the Translator being present in RAM

Counting Occurrences

5.1 Set the Counter to 0 

5.2 Loop round for all the positions in the array

5.3 If the current position is the Target Value

5.4 Add 1 to Counter

5.5 End If

5.6 End loop

Finding Maximum3.1 Set the lowest place in the array to maximum

3.2 Loop For the size of the array

3.3 If the current score is higher than maximum then set to maximum

3.4 End if

3.5 End Loop

Linear Search

4.1 Ask user for the target value

4.2 loop for each item in the list

4.3 If current item = target value then

4.4 Display target value

4.5 End if

4.6 End loop

Arrangements

Arrangements


Recommended