National 5 Computing Science Software Design & Development

Similar documents
Chapter 1: Why Program? Computers and Programming. Why Program?

INTRODUCTION TO COMPUTERS

Computers Are Your Future

Topics. Hardware and Software. Introduction. Main Memory. The CPU 9/21/2014. Introduction to Computers and Programming

Chapter 1: Introduction to Computers and Programming

1.1 Bits and Bit Patterns. Boolean Operations. Figure 2.1 CPU and main memory connected via a bus. CS11102 Introduction to Computer Science

Chapter 4 The Components of the System Unit

Chapter 1: Why Program? Main Hardware Component Categories 8/23/2014. Main Hardware Component Categories: Why Program?

The type of all data used in a C (or C++) program must be specified

Electricity: Voltage. Gate: A signal enters the gate at a certain voltage. The gate performs operations on it, and sends it out was a new signal.

System Unit Components Chapter2

IB Computer Science Topic.2-

Chapter 2. Prepared By: Humeyra Saracoglu

2.2 THE MARIE Instruction Set Architecture

The type of all data used in a C++ program must be specified

Introduction. Arizona State University 1

Intentionally Blank 0

St. Benedict s High School. Computing Science. Software Design & Development. (Part 2 Computer Architecture) National 5

Lecture Objectives. Introduction to Computing Chapter 0. Topics. Numbering Systems 04/09/2017

Homeschool Enrichment. The System Unit: Processing & Memory

Chapter 1. Data Storage Pearson Addison-Wesley. All rights reserved

Chapter 4 The Components of the System Unit

C H A P T E R 1. Introduction to Computers and Programming

Experimental Methods I

Sahalsoftware college. Welcome To understanding Basic Computer Concept

COMPUTER SYSTEM. COMPUTER SYSTEM IB DP Computer science Standard Level ICS3U. COMPUTER SYSTEM IB DP Computer science Standard Level ICS3U

I1100 E Introduction to computer.

Components of a Computer System

Final Labs and Tutors

Introduction to computers

Chapter 1: Introduction to Computers and Java

Computer Organization

8/23/2014. Chapter Topics. Introduction. Java History. Why Program? Java Applications and Applets. Chapter 1: Introduction to Computers and Java

Management Information Systems OUTLINE OBJECTIVES. Information Systems: Computer Hardware. Dr. Shankar Sundaresan

Introduction to Computers. Joslyn A. Smith

System Unit Components. Chapter2

Chapter One. Introduction to Computer System

An Overview of the Computer System. Kafui A. Prebbie 24

AQA GCSE Computer Science PLC

HARDWARE. There are a number of factors that effect the speed of the processor. Explain how these factors affect the speed of the computer s CPU.

Unit - II. Computer Concepts and C Programming 06CCP13. Unit II

HASTINGS HIGH SCHOOL

The personal computer system uses the following hardware device types -

Dec Hex Bin ORG ; ZERO. Introduction To Computing

Switching to AQA from OCR

GCSE Computer Science Component 02

Zimmer CSCI /24/18. CHAPTER 1 Overview. COMPUTER Programmable devices that can store, retrieve, and process data.

15/09/15. Introduction to Computers & The Internet. Contents. Computer hardware and software. Input and output devices CPU. Memory.

Ch. 1: Computer System part I

CS 101, Mock Computer Architecture

CC411: Introduction To Microprocessors

CMSC 1513 Lecture 1.2

Chapter 1 Introduction to Computers and Programming

KULLEĠĠ SAN BENEDITTU Secondary School, Kirkop

Computers Are Your Future

CHAPTER 1 Introduction to Computers and Java

Unit 2: Technology Systems

Bits, bytes, binary numbers, and the representation of information

Main Parts of Personal Computer

Week One: Introduction A SHORT INTRODUCTION TO HARDWARE, SOFTWARE, AND ALGORITHM DEVELOPMENT

Autumn 1 Autumn 2 Spring 1 Spring 2 Summer 1 Summer 2. networks. environmental concerns. Knowledge and skills covered: Knowledge and skills covered:

Exercise 2 : Complete each sentence or statement. 1. data consists of numbers that might be used in arithmetic operations.

MSc-IT 1st Semester Fall 2016, Course Instructor M. Imran khalil 1

Three-box Model: These three boxes need interconnecting (usually done by wiring known as a bus. 1. Processor CPU e.g. Pentium 4 2.

CS 105 Review Questions #3

Chapter Two. Hardware Basics: Inside the Box

Bits and Bit Patterns

Technology in Action. Chapter Topics. Participation Question. Participation Question. Participation Question 8/8/11

The Programming Process Summer 2010 Margaret Reid-Miller

COMP Computer Basics. Yi Hong May 13, 2015

The Central Processing Unit

What did we talk about last time? Examples switch statements

Parts are adapted from Windows 98 by Mark Twain Media, Inc. A Computer System has Hardware and Software

INTRODUCTION TO INFORMATION & COMMUNICATION TECHNOLOGY (ICT) LECTURE 2 : WEEK 2 CSC-111-T

Switching to AQA from Edexcel

Computer Organization

OCR GCSE (9-1) Computer Science J276 Accompanying Instructional Document

CREATED BY M BILAL & Arslan Ahmad Shaad Visit:

HARDWARE AND OPERATING SYSTEMS

Edexcel GCSE in Computer Science Microsoft IT Academy Mapping

Computing 1: Computer Systems

Computer Systems. Binary Representation. Binary Representation. Logical Computation: Boolean Algebra

8/16/12. Computer Organization. Architecture. Computer Organization. Computer Basics

Hardware Revision. AQA Computing AS-Level COMP2. 63 minutes. 60 marks. Page 1 of 24

CHAPTER 1 TYPES & COMPONENTS OF COMPUTER SYSTEM

GCSE Computer Science for OCR Overview Scheme of Work

Intermediate Programming & Design (C++) Notation

Computer Organization

N5 Computing Science - Solutions

Information Science 1

The Building Blocks: Binary Numbers, Boolean Logic, and Gates. Purpose of Chapter. External Representation of Information.

Discussion. Why do we use Base 10?

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

More Programming Constructs -- Introduction

Lecture 03 Bits, Bytes and Data Types

Computer is an electronic machine that can receive, store, transform and output data of all kinds (image, text, numeric, graphics and sound).

Introduction to Computers - Chapter 4

Microprocessors I MICROCOMPUTERS AND MICROPROCESSORS

PARTS OF THE COMPUTER. 2nd ESO IES CAP DE LLEVANT

VARIABLES. Aim Understanding how computer programs store values, and how they are accessed and used in computer programs.

Transcription:

National 5 Computing Science Software Design & Development 1 Stages of Development 2 Analysis 3 Design 4 Implementation 5 Testing 6 Documentation 7 Evaluation 8 Maintenance 9 Data Types & Structures 10 Readability of code 11 The Computer Program 12 Translators 13 Representing Data text, numbers, graphics, instructions 14 Computer Architecture 15 Memory 16 Buses 17 Interfaces 18 Storage 1

1 Stages When developing a solution to a software problem the stages that would be followed are; Analysis Design Implementation Testing Documentation Evaluation Maintenance This is often called the cascade method since each stage follows another. At each stage when a problem occurs, the developer may have to re-visit the previous stage and alter this to overcome the problem, this is called iteration. This is not the only method of arriving at a solution 2 Analysis For large problems or tasks this stage is done by a Systems Analyst. The Analyst will study the problem to understand it clearly. They will observe any existing system that is to be replaced or upgraded. They will interview the relevant staff. This information will be gathered into a formal document called the requirements specification. The Analyst will devise a solution and produce a software specification detailing how the new system will operate. For small problems, such as the ones we do in this course, the analysis stage is where you read the problem carefully and express it in your own words. You should also identify the inputs, processes and outputs. Example a program needs to be designed and written that allows the user to enter 3 numbers, adds then together and displays the result. Analysis I need to design and write a program where the user will enter three numbers. The numbers are then added together and the answer is displayed. INPUT PROCESS OUTPUT firstnumber, secondnumber, thirdnumber answer=firstnumber+secondnumber+thirdnumber answer 2

3 Design This is the second stage of development. For large problems the designers would take the Analysts software specification and produce designs for each part of the solution from screen designs to what the final output will look like. Along the way they would ensure that suitable help and error messages are built into the software to aid the user. A common way of representing a design is using a top down approach. This means starting at the top then breaking the problem into tasks which can be broken down into smaller tasks and so on. problem Level 1 task Level 1 task Level 1 task Level 2 task Level 2 task Level 2 task Level 2 task b2 a1 a2 b1 There are two common methods used to represent designs in this way, graphical and text based. (a) Structure Diagrams (Graphical) here boxes are used to show the solution. Example Top box with program name in it Procedure Box Sequence or command box Selection Or Repetition (b) Pseudocode(Text Based) here the design is written in words but structured as before. The type of pseudocode that you must become familiar with is HAGGIS. This will be used in the final exam where you will be asked about sections of pseudocode. Using the example from the analysis stage here is the Haggis pseudocode for the adding 3 numbers problem. line 1 RECEIVE firstnumber FROM KEYBOARD 3

2 RECEIVE secondnumber FROM KEYBOARD 3 RECEIVE thirdnumber FROM KEYBOARD 4 SET answer TO firstnumber+secondnumber+thirdnumber 5 SEND answer TO DISPLAY At the design stage you may find that something specified by the Analyst may not be possible so the system specification may need re-visited (iteration) and altered accordingly. 4 Implementation At this stage the programmers take over and write the code to match the design. For a large project many programmers would work on various parts of the software each with a different task to do according to their individual expertise. The points the programming team must consider are: The nature of the problem The programming language Who will use the software? Cost and Technical limitations. The rules the programmers use are the same whether it is a small or large task. The program must be structured Variable, procedure and function names must be meaningful Internal documentation is essential. Continuing with our 3 numbers example here is the FreeBASIC version of the program 4

5 Testing This can take place at two of the stages, design and after implementation. Design testing allows you to see if the logic of your program works or not so you can alter it if need be. Test data tables can be constructed to do this. Testing after the program has been written allows the programmer to detect errors in the code. These test runs can use the previously developed test data tables to verify the logic but other errors may appear such as SYNTAX errors. Syntax is the rules or grammar of a language. Syntax errors are often simple such as missing punctuation marks or a misnamed variable. For most of the programs you will develop there are some simple guidelines. Test 1 Test 2 Test 3 Normal data (that which is expected) Extreme data (at the limits of the problem) Exceptional data (anything outside the range) Using the 3 numbers program we will construct a test data table then actually run the program with the data. Test firstnumber secondnumber thirdnumber Expected No Outcome 1 8 7 4 19 2 0 100000 0 100000 3 5.1-99 abc? Normal Extreme - there are no real limits to this program so this is not really needed Exceptional using non-integer and text. In large projects testing in the developer s environment is called alpha testing. When the software is installed on the client s computers and tested this is called Beta testing. 5

6 Documentation This consists of two major parts, the user guide and the technical guide. The User Guide This will contain detailed instructions for the user on how to actually operate the software and use all of its features. In the past this would be a manual but these days it is more than likely on-line help and on-line tutorials. The Technical Guide This will contain information of a more technical nature such as installation instructions and minimum hardware and software specifications. 7 Evaluation In reality a company would very rarely evaluate a project themselves, the people who buy the software would do this. In programming coursework s it is expected that you will evaluate your software and consider the points listed below: Comment on the overall solution is it fit for purpose? Comment on the test data and the reasons you chose it. Describe any problems you had and how you overcame them. Suggest any improvements you could make if you had the time. Suggest alternatives that would be easier than writing a program Using the 3 numbers program as an example here is an evaluation. Evaluation of the three numbers program The program I have written works well with sets of normal data. In this case there is no real extremes so the program was only further tested with exceptional data. It accepts non-integer numbers such as 5.1 and also accepts text as well as negative integers. The output for the exceptional data indicates that the 5.1 has the 0.1 removed to make it integer and the text is regarded as 0. When I wrote the program the answer did not appear on screen. There was an error on the print line where I had forgotten to place the variable answer after I had closed my quotes. I fixed this problem by inserting a semi-colon followed by the variable answer and the program ran well. The program would benefit from a much better display as the interface is limited. A spreadsheet could be used to perform the same calculation or even a calculator. 6

8 Maintenance This begins as soon as the software is delivered to the customer. Testing can never be completely extensive so errors will and do appear once the customer begins to use the program. Altering such errors is the responsibility of the developers and is called corrective maintenance. In time the customer may wish to adapt the software to cope with new hardware or operating systems or even upgrade the whole system so that it is improved (adaptive). The client may also ask for the software to be altered to do tasks not originally specified this is called perfective maintenance. 9 Data Types and Structures Most High Level Languages (HLL s) are capable of handling a variety of data types. Numbers Integer this are positive and negative whole numbers. For example 23, 7, -87, 1 Real any other number. For example 0.004, -12.6, 1010107.9, 0.67 Characters String so called because it can represent any string of characters. For example Fred, abc123, OOP Boolean This is any type of data that can only have one of two values such ON or OFF, TRUE or FALSE, 1 or 0 Data Structures One dimensional array (1D array) this can hold a set of related data in an organised (indexed) way. For example A list of names names[fred, Ian, Alex, Susan, Ann] This is a 1D array of strings. It has 5 data items in it and each data item has its own index, for example names[4]= Susan A group of temperatures temp[12.7, 14.9, 8.3, 9.9, 7.2, 4.5, 11.3, 23.7] This is a 1D array of real numbers. Temp[3]=8.3 7

Testing and Documentation When developing or testing a program errors can often be detected that need correcting. There are 3 types of error associated with programming: Syntax this is a mistake in the rules or grammar of a language for example: Print hello Input Enter name myname the quotes have not been closed a comma after the quotes has been missed Execution these occur when the program is running, often leaving the screen blank or closing the output before anything has happed. Logic these are design errors, in others words the computer cannot make sense of the logic of the programmer, for example: Input Enter first number >>,first Answer = first * second The error here is that the system does not know what second is so how can it process the answer line. 10 Readability of Code It is important that program code is understandable not only to the programmer but to others who may look at the code. There are 3 key ways of improving readability: Internal Commentary these are lines in the code that explain what the code is doing but have no effect on the code itself. Meaningful Identifiers these are the names of variable, procedures and functions. Simply if a variable is used to calculate someone s total tax then call it total_tax_bill. Indentation using indents for control structures displays visually the logic and data flow within a program. This can be demonstrated by an example see the file in your subjects folder called readability of code. 8

11 Computer Program Definition : a sequence of instructions that a computer can interpret and execute. A sequence of instructions means a list of commands entered by the programmer. Interpret means change to a language the computer understands and execute is when it does the task. Programming languages have been developed using words from English that make it easier for use to write a program. The original program is called the source code. A computer uses binary, 1 s and 0 s, to do everything. For us to communicate with the computer in binary would be difficult, long and easy to make mistakes. The programs we write need translated into binary or machine code as it is known. Example Source Code Print Hello everybody Print This is programming Machine Code translator 1000101010010010 0101001010101010 0100010101010101 00101010101010 There are many types of program each for a different purpose: Applications these help work on different types of data such as spreadsheets for numbers, word processing for text and so on. Games programs for entertainment using high end graphics and sound. Utility programs to help us run the computer system efficiently such as anti-virus and disk defragmenters. 12 Translators Programming languages that use words from English are called High Level Languages (HLL) and use 2 main types of translator: Compiler this waits until the programmer has entered all the program code then attempts to translate before execution. It makes finding and correcting errors slightly difficult. Once translated the machine code version is stored and there is no need to translate again when the program is run. Interpreter this tries to translate as each instruction is entered so finding and correcting errors is simple. Here the source code version of the program is stored so it must be translated each time it is run making their execution slower than compiled programs. In large programming projects interpreters are used in development but the finished version is compiled. 9

Assembly language is a slightly more readable version of machine code often used by computer engineers since it requires little translation (using an assembler) so programs run very quickly. 13 Representing Data Why binary? Computers are electrical machines. Relating our language to that of electricity is very difficult considering how complex our language is. Using a coding system of numbers also becomes complicated due the nature of electricity. The simplest we can make it is if a voltage is there it s a 1 and if it s not it s a 0. Binary numbers have been known and used for many years so it seemed sensible to use binary as the computers own language. A single 1 or 0 is known as a bit (BInary digit). Obviously a single bit is not particularly useful amount so we created a measuring system for multiple bits. 8 bits = 1 byte, 1024 bytes = 1 Kilobyte (Kb), 1024 Kb = 1 Megabyte (Mb) 1024 Mb = 1 Gigabyte (Gb), 1024 Gb = 1 Terabyte, 1024 Tb = 1 Petabyte (Pb) The computer uses binary to represent and process data. Each type of data is represented in a different way. Types of Data Text or to give it its formal name alphanumeric data this is simply characters, words, codes or anything that does not have a numerical value. The computer has a table of values stored so when a character is used it looks up the table to find its binary code. ASCII was the standard for many years. For example if you pressed A on the keyboard this is entry 65 in the ASCII table and has a binary code of 01000001. Here are some other examples of ASCII: Character Table position Binary Code & 38 00100110 Q 121 01111001 5 53 00110101 ] 93 01011101 In recent years ASCII has been replaced by Unicode which can code over 65000 character s as opposed to ASCII s 256. Number anything that has a numerical value. 10

Integers these are positive or negative whole numbers. The computer simply convert these to binary. Converting to binary. The best way to do this is to create a table as seen below. We make the binary number by entering 1 in the box if it can be used to make the number we want or 0 if it s not needed. The table can be used in reverse to convert binary to decimal. Convert 51 and 142 to binary. Convert 111010 and 10101011 to decimal Decimal 128 64 32 16 8 4 2 1 Decimal 51 0 0 1 1 0 0 1 1 142 1 0 0 0 1 1 1 0 0 0 1 1 1 0 1 0 58 1 0 1 0 1 0 1 1 171 51 = 32+16+2+1 142 = 128+32+8+4+2. 11010 = 32+16+8+2 = 58 10101011= 128+32+8+2+1 = 171 Real Numbers any number including integers are called real. Since these can have a fractional part the simple conversion to binary does not apply. A system called floating point representation is used, where the number is broken into two parts the mantissa and the exponent. Here is an example in decimal. 796.315 = 0.796315 x 10 3 where 796315 is the mantissa and 3 is the exponent. 0.00000297 = 0.297 x 10-5 where 297 is the mantissa and -5 is the exponent. The computer can allocate storage to both parts of the number and never bother where the decimal point actually is. 11

Graphics - there are two basic methods the computer uses to represent graphics. Images are made up of pixels (picture elements) where each pixels position and colour is stored by the computer so that it can recreate it. These are called bit-mapped graphics. 1 0 0 0 0 0 1 0 1 1 0 0 0 1 0 1 1 0 1 0 1 0 0 1 1 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 1 0 1 0 1 0 0 1 1 1 0 0 0 1 0 1 1 0 0 0 0 0 1 0 In the above each black pixel is a 1 and each white is a 0 so creating the bit-map on the right. Exercise create a grid as above then create the letter G by shading the boxes. Write down the bit-map version of this. The computer can also store images as a series of objects, storing just the instructions needed to recreate the object rather than every individual pixel. These are called vector graphics. Vector graphics generally have a much smaller file size than bit-mapped graphics. Vector graphics can only be edited at object level whereas bit-mapped graphics can be edited down to a single pixel. Instructions in reality the computer sees no difference between data and instructions and treats them the same. Machine Instructions contain 2 parts, the op-code and the operand. Opcodes are things like STORE, JUMP, LOAD, SUB (known as mnemonics shorted version s of words i.e. SUB = Subtract) giving a general idea of what is to be done the operand contains the details such as where the data is held. 12

14 Computer Architecture In this section will shall look at the parts of the computer system that actually do all the storing, processing and manipulation of data. Processor Definition : A central processing unit (CPU) is the hardware within a computer that carries out the instructions of a computer program by performing the basic arithmetical, logical, and input/output operations of the system. The processor itself consists of: Control Unit this ensures all the steps in a are carried out in the correct order and that any unit required is accessed. process Arithmetic & Logic Unit (ALU) this carries out all calculations and logic operations. This is an important unit since all data and instructions end up as binary numbers so the ALU is used to manipulate them. Registers these are temporary storage locations in the processor that keep data, addresses and instructions currently in use so saving the processor from having to access memory all the time. 15 Memory Memory is made up of storage locations in which the binary data can be stored. For data to be found easily each storage location has a unique address in the form of a binary number. The main memory of a computer consists of two parts: Random Access Memory (RAM) this is the part of the memory for use to use storing programs and data currently in use. RAM is volatile, which means it is erased when the computer is off. Read Only Memory (ROM) software and data for system operation are stored in ROM and as the name indicates these can only be read and no data written to it. ROM contents are retained even when the computer is off. Cache memory is now found in almost all computers and is a high speed low capacity storage area for frequently used instructions and data reducing the need for access to RAM and improving system performance. 13

16 Buses To carry data around the CPU buses are needed. These are sets of parallel lines along which the data can be sent. Data bus this carries data to and from memory. The number of lines in the data bus is often referred to as the word length of the computer. A word is the number of bits a computer can handle in a single operation. It is also efficient is each storage location in memory is the same size as the data bus so data can be transferred easily. Address bus this is used to specify the address at which data or instructions are held in memory. The address bus only goes in one direction. Control bus this is not a true bus but simply a set of individual lines that have a function to perform in processes. These include read and write lines which are activated when data is to be written to or read from the memory. 17 Interfaces All devices that are connected to the CPU require to do this through an interface. Interfaces not only allow the physical connection but perform so essential tasks such as: Data Storage holding data in transit between the CPU and the peripheral device. Data Conversion changing data to a form the CPU can understand or the device can understand. Status Signals indicating whether or not a device requires data from the CPU. Protocol Conversion tailoring the rules for the transfer of data. The most widely used interface at present is USB (Universal Serial Bus). USB (full speed) 1 was produced by Intel and in circulation by 1995, it boasted a transfer speed of 12Mbit/s (Megabits per second). USB (high speed) 2 came out in 2000 and had a transfer rate of 480Mbit/s. USB (super speed) 3 arrived in 2008 with a transfer rate of 5Gbit/s. Other interfaces include IEEE 1394 (Firewire), Ethernet and MIDI. 18 Storage Backing storage is required in a computer system so that files can be stored for use again another time because RAM is erased. The most common forms of backing storage are: Hard Disk Drive uses a magnetic process for storage on a metal disk, high capacity DVD drive uses optical processes to store onto plastic disc. USB Flash Drive uses electric processes to store onto a chip, robust due to no mechanical parts. 14