Software development slides

  • 164 views
Uploaded on

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
164
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
2
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. National 5 Computer Science Software Development Faculty of ICT
  • 2. Aims - Systems Lesson 1  To introduce Course Structure  Issue Jotters/Resources  Rules  5 Box Diagram  Discuss Hardware/Software/Input/Output Device  Create Folder label
  • 3. Class Rules 1. 2. 3. 4. 5. 6. 7. 8. 9. Get to class on time and line up quietly with jacket off Come into class in an orderly fashion and take out folder No chewing gum!!!!!!!!!!!!!!!!!!!!!!!! Always sit at the “Theory desks” to see lesson aims Take out pencil/pen No talking when I am talking!!!!!!!!!!!!!!!!!!!!!!!! Hands up when answering Treat others in class with respect Follow all instructions
  • 4. 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
  • 5. Folders to Create  S4   Computer Science Software Development Info Systems Design and Development
  • 6. 5 Box Diagram
  • 7. Aims - Systems Lesson 2 Last Lesson  5 Box Diagram  Hardware/Software/In put/Output Device  Folder label Today  Main Memory    RAM ROM Create poster on Hardware/Software/R AM and ROM
  • 8. 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
  • 9. Main Memory  Read   Only Memory Data is stored permanently and cannot be changed Data is written to ROM at manufacture
  • 10. Lesson Starter 1. 2. 3. Give 3 examples of Input Devices What does RAM and ROM stand for? What is the difference between RAM and ROM?
  • 11. 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
  • 12. 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 
  • 13. 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
  • 14. 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
  • 15. 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
  • 16. 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
  • 17. Aims - Systems Lesson 4 Last Lesson  The Processor  ALU/Control Unit Today  The Processor  Registers Address Bus  Revision Questions 
  • 18. Processor
  • 19. 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
  • 20. 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
  • 21. Aims - Systems Lesson 5 Last Lesson  The Processor   Registers Address Bus Today  Data Bus  Interfaces
  • 22. Aims - Systems Lesson 6 Last Lesson  Data Bus  Interfaces Today  Data Storage  Storage Units  Storage Calculations
  • 23. 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
  • 24. 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
  • 25. 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
  • 26. 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?
  • 27. Lesson Starter  How many 4Mb images can you store on an 8Gb Iphone?
  • 28. Aims - Systems Lesson 7 Last Lesson  Data Storage  Storage Units  Storage Calculations Today  Representing positive whole numbers   Decimal to Binary Binary to Decimal
  • 29. 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 
  • 30. How Positive Whole Numbers are Stored 34 128 64 32 0 0 1 = 32 + 2  134 128 64 32 1 0 0 = 128 + 4 + 2  16 0 8 0 4 0 2 1 1 0 16 0 8 0 4 1 2 1 1 0
  • 31. Binary back to Decimal 1011 0011 128 64 32 16 8 1 0 1 1 0 = 128 + 32 + 16 + 2 + 1 =179 4 0 2 1 1 1
  • 32. 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 
  • 33. Aims - Systems Lesson 8 Last Lesson Today  Representing positive  Representing decimal whole numbers numbers using  Decimal to Binary Floating Point  Binary to Decimal
  • 34. Representing Non Whole Numbers  How do we represent the number 128.75 in binary? 128 64 32 16 1 0 0 0  128 8 0 4 2 0 + 0.5 + 0.25  = 128.75 1 0 0.5 0 1 0.25 0.125 1 0 0.0625 0
  • 35. Mantissa and Exponent 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 0 0 0 0 0 1 1 0 0  Mantissa 1 0 0  Exponent 8 8 4 2 1 0 0 1 0
  • 36. 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 1 0 0 1 1 0 0 0 1 0 1 1 0 0 0 1  Mantissa 1 0 0  Exponent 6 8 4 2 0 1 1 1 0 0
  • 37. Representing Non Whole Numbers  Mantissa relates to the precision of the number you can represent i.e 34.44454321 8 4 2 1  Exponent 0.5 0.25 0.125 0.075 0.0375 0.01875 0.009375 relates to the position of the decimal point and the range of the number
  • 38. Aims - Systems Lesson 9 Last Lesson Today  Representing decimal  Representing numbers using characters Floating Point  ASCII  Unicode
  • 39. How are Characters Represented  ASCII     Character Set   American Standard Code for Information Interchange Each key on the keyboard is converted into a binary code using 7 bits 7 Using 7 bits i.e 2 = 128 characters can be represented 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 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
  • 40. Unicode  Unicode is coding system which uses 16 bits per character 16  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
  • 41. Binary Message 1010100 0100000 1010100 0100000 1001000 1001001 1001000 1010111 1001000 1001001 1001111 1000010 1001001 1000101 1000101 1010011 1010010 1001100 1010011 1000001 1010010 0100000 1010010 1000101
  • 42. Lesson Starter 1. 2. 3. 4. How many characters can be represented in ASCII? Give 1 advantage and 1 disadvantage of Unicode over ASCII Convert 129 to binary What 2 items are stored in Floating Point?
  • 43. Aims - Systems Lesson 10 Last Lesson  Representing characters   ASCII Unicode Today  Representing Bitmap images  Pixels and Resolution
  • 44. BIT Map Graphics SCREEN MEMORY PIXEL Bit Map = the graphic is made up from a series of pixels MEMORY REQUIRED 8 BITS X 8 BITS = 64 BITS = 8 BYTES
  • 45. 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
  • 46. 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
  • 47. 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
  • 48. 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
  • 49. 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
  • 50. 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
  • 51. Aims - Systems Lesson 12 Last Lesson  Representing Bitmap images  Pixels and Resolution  Bitmap Calculations  Vector Images Today  Colour Depth  Compression
  • 52. 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
  • 53. 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
  • 54. Quiz 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Which bus is unidirectional? (1) List the 3 parts of the processor (3) What is the difference between RAM and ROM? (1) Convert 99 to binary (1) What is the difference between a Bitmap image and a Vector image? (1) How many bits are used per character in ASCII and Unicode? (2) What is the bitdepth of the image if it is in 65,536 colours? (1) I have an image that is 700 pixels by 400 pixels in True Colour. Calculate the storage requirements of the image (2) What is the difference between Lossy and Lossless compression? (2) When storing a real number using Floating Point, what 2 items are stored? (2)
  • 55. Aims - Systems Lesson 13 Last Lesson  Colour Depth  Compression Today  File Formats  Audio Sampling
  • 56. Audio Sampling
  • 57. 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
  • 58. Aims - Systems Lesson 12 Last Lesson  Bitmap Calculations  Vector Images Today  Systems End of Unit Test
  • 59. Aims – Software Development Lesson 1 Today  Variables  Variable types  Creating Variables  Assigning Data to Variables
  • 60. 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
  • 61. 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”
  • 62. Lesson Starter 1. 2. What is a variable? Give 3 different variable types
  • 63. Aims – Software Development Lesson 2 Last Lesson  Variables  Variable types  Creating Variables  Assigning Data to Variables Today  Arithmetic Operators  String Manipulation
  • 64. 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
  • 65. 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
  • 66. Lesson Starter 1. 2. 3. I have the variables area, length and breadth. Write the code to calculate the area, using the other variables 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 What is meant by string concatenation?
  • 67. Aims – Software Development Lesson 3 Last Lesson  Arithmetic Operators  String Manipulation Today  Conditional Statements  Logical Operators
  • 68. 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
  • 69. 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 happen If firstname = “Henry” AND surname = “Haggarty” then outcome = “legend” End if  OR = when 1 part of the condition must be met for the outcome to happen If team = “Celtic” OR team = “Rangers” then supporter = “idiot” End if
  • 70. Aims – Software Development Lesson 4 Last Lesson  Conditional Statements  Logical Operators Today  Loops   Fixed Conditional
  • 71. 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
  • 72. 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
  • 73. Nested Loop A loop inside a loop For 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
  • 74. 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”
  • 75. Aims – Software Development Lesson 6 Last Lesson  Nested Loops  Input Validation Today  Predefined Functions  1 Dimensional Arrays
  • 76. 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)
  • 77. 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
  • 78. Readability of Code  Indentation For 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
  • 79. 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
  • 80. Text Based Design Notation  Pseudocode  Where the stages of the program are broken down and written in English steps
  • 81. Lesson Starter 1. 2. 3. Give 3 ways that you can improve the Readability of a program 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 What design notation do you currently use to break problems down into simpler steps
  • 82. Graphical Design Notations  Flow  Charts These use different shaped boxes to represent programming elements    Diamonds = if statements Rounded rectangles = loops Rectangles = calculations
  • 83. Case Diagram  This gives a quick overview of how a program or system works  This is a Case Diagram for a Customer Order System
  • 84. Activity Diagrams  More complex flow chart  B = start or end of an activity  Black circle represent the final state
  • 85. 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
  • 86. Aims – Software Development Lesson 7 Last Lesson  Predefined Functions  1 Dimensional Arrays Today  Filling Arrays with For Loops  Testing
  • 87. 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
  • 88. 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
  • 89. Lesson Starter
  • 90. Lesson Starter
  • 91. 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” 
  • 92. Aims – Software Development Lesson 8 Last Lesson  Filling Arrays with For Loops  Testing Today  Errors in Code  Readability
  • 93. 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”
  • 94. 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
  • 95. 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
  • 96. 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
  • 97. Finding Maximum 3.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
  • 98. 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
  • 99. Arrangements
  • 100. Arrangements