SOFTWARE DEVELOPMENT


Development Methodologies


Computational Thinking

Computational thinking is the act of designing a solution to a problem so it can be solved by a computer. Below are the steps in which you can solve a problem using computational thinking
  • Analysis - Understanding the problem
  • Design - Work out steps to solve said problem
  • Implementation - Create a working program based on the design
  • Testing - Making sure your solution fits all use cases
  • Documentation - Describe how your solution works and how to use it
  • Evaluation - Checking to see if your solution covers all points made in the original request

Waterfall Model

The Waterfall Model is an Iterative Development Methodology meaning that previous stages can be revisited and improved on, there are often multiple cycles before a solution that fits all use cases is found.
Waterfall Model Diagram

There are some advantages to the waterfall model
  • Its simple to understand and use
  • You move from one stage to the next stage
  • This methodology is ideal for smaller projects

Summary

  • Algorithm - An Algorithm is a set of instructions used to solve a problem, e.g making a cup of coffee
  • Computational Thinking - Computational Thinking is the act of designing a solution so it can be solved by a computer
    • The stages of computational thinking are - analysis, design, implementation, testing, documentation & evaluation
  • Waterfall Model - an iterative development methodology that's ideal for small projects

Try some of the questions below

  1. What is Computational Thinking the act of designing a solution to a problem so it can be solved by a computer
  2. What is an algorithm A set of instructions you can follow to solve a problem
  3. State the terms for the below sentences (software development cycle)
    • Changing a design into a program Implementation
    • Looking at and understanding the problem Analysis
    • Describing what each part of the program does Documentation
    • Working out a series of steps to solve a problem Design
    • Checking whether the program contains mistakes Testing
    • Ensuring that the software fits all of the original requirements Evaluation
  4. Extra: Write an algorithm for making a cup of tea


Software Analysis


Analysis

Analysis is the stage at which you look at and understand the problem you're facing, this is also the stage you would meet the client. At the end of the analysis stage, a software specification is produced. See here for an example specification.

User & Functional Requirements

In a Specification, you need to be able to identify inputs, processes and outputs for each part of the solution. Example Question Below
  • "I want a program that takes in a person's name and age, works out the year they were born and tells them"

    - Input(s): user name & age

    - Process(es): work out user birth year

    - Output(s): users birth year

Try the below questions, identifying the inputs, outputs and processes for each. For an extra challenge you can try coding a program for the 1st & 2nd problem
  • "A program is to be written to simulate the basic arithmetic functions of a calculator. The user should be asked to input two numbers and the sum (+), difference (-), product (*) and quotient (/) should be displayed"

    - Input(s): 2 numbers

    - Process(es): Calculate the sum, difference, product & quotient of the 2 numbers

    - Output(s): sum, difference, product & quotient of the 2 numbers

    Code
    numOne = int(input('Enter a Number: ''))
    numTwo = int(input('Enter Another Number: '))
    
    sumNum = numOne + numTwo
    diffNum = numOne - numTwo
    prodNum = numOne * numTwo
    quotNum = numOne / numTwo
    
    print('Sum: ' + str(sumNum))
    print('Difference: ' + str(diffNum))
    print('Product: ' + str(prodNum))
    print('Quotient: ' + str(quotNum))

  • "A school needs a program to grade students' marks after an exam. The program should take in an integer between 0 and 100 and output a grade"

    - Input(s): an integer between 0 and 100

    - Process(es): Find the students grade

    - Output(s): The students grade

    Code
    gradeNum = int(input('Enter Number: '))
    while gradeNum < 0 or gradeNum > 100:
    	print('Error, number is <0 or >100')
    	gradeNum = int(input('Enter Number: '))
    
    if gradeNum >= 70: print('Student Achieved Grade A')
    elif gradeNum < 70 and gradeNum >= 60: 
    	print('Student Achieved Grade B')
    
    elif gradeNum < 60 and gradeNum >= 50: 
    	print('Student Achieved Grade C')
    
    elif gradeNum < 50 and gradeNum >= 40: 
    	print('Student Achieved Grade D')
    
    else: print('Student Failed')

  • "A program is needed to calculate the speed at which an arrow is traveling at. It measures the time it takes the arrow to travel a marked distance between 2 sensors and calculates the speed of the arrow. The program should show the speed at which the arrow is traveling."

    - Input(s): the time it takes the arrow to travel between 2 sensors, distance between sensors

    - Process(es): How fast the arrow traveled

    - Output(s): Speed of the arrow


Design


Design

Design Notation are ways of representing a program or algorithm. There are 2 types at this level

  • Graphical Design Notation - Uses shapes to describe a design (Structure Diagrams & Flowcharts)
  • Pseudocode - Uses Ordinary English to Define steps in a problem

Structure Diagrams

Breaking down a problem into smaller and smaller steps (subproblems) and is looked at from top down & left to right
Structure Diagram
Draw a structure diagram for the following problem
"I want a program that takes in 3 football scores, works out the total goals scored & the average, then outputs a message with the total & average"
Structure Diagram

Flowcharts

Represents a set of instructions including the flow of the program. It has specific symbols for set actions
Structure Diagram
Structure Diagram

Pseudocode

Pseudocode uses english-like text to describe steps in a program e.g
INPUT "which is the best subject?"
WHILE answer != "computing science" THEN:
	SEND "Try Again" TO DISPLAY
SEND "Of Course It Is" TO DISPLAY

Wireframes

A wireframe is a graphic design notation used to display how the ui of a program would look, including inputs, processes and outputs
Structure Diagram

Practical Questions

  • Using a graphical design notation of your choice, write algorithms for the following problems
    • "Calculate the circumference of a circle giving the radius as input (2πr)"
      Pseudocode
      DECLARE pi INITIALLY 3.14
      SEND "Enter Radius: " TO SCREEN
      DECLARE radius INITIALLY KEYBOARD INPUT 
      DECLARE circumference INITIALLY 2*pi*radius
      SEND circumference TO SCREEN
      Code
      pi = 3.14
      radius = float(input('Enter Radius of Circle: '))
      circumference = 2*pi*radius
      print(circumference)
    • "A quiz with 4 questions and a 2nd chance to get the correct answer after a hint is given"
      Pseudocode
      DECLARE questions INITIALLY ARRAY OF STRING ['5+5', '10-5', '5-3', '10-7']
      DECLARE hints INITIALLY ARRAY OF STRING ['15-5', '10-5', '1+1', '2+1']
      DECLARE answers INITIALLY ARRAY OF INTEGER [10, 5, 2, 3]
      
      FOR i IN RANGE(LENGTH questions) DO
      	SEND f"Question {i}: What is {questions[i]}" TO SCREEN
      	SET ans AS INTEGER KEYBOARD INPUT
      
      	IF ans != answers[i] THEN
      		SEND f"Wrong, hint: {hints[i]}" TO SCREEN
      		SET ans AS INTEGER KEYBOARD INPUT
      
      		IF ans != answers[i] THEN
      			SEND f"Wrong, try another question" TO SCREEN
      Code
      questions = ['5+5', '10-5', '5-3', '10-7']
      answers = [10, 5, 2, 3]
      hints = ['15-5', '10-5', '1+1', '2+1']
      
      for i in range(len(questions)):
      	ans = int(input(f'Question {i}: What\'s {questions[i]}: '))
      
      	if ans != answers[i]:
      		ans = int(input(f'Wrong, hint: {answers[i]} is the same as {hints[i]}'))
      		if ans != answers[i]: print('Wrong, try another question')
  • Investigate online tools for creating design notations. For Example
  • Create programs to solve each of the problems above, using a programming language of your choice

Design


Implementation

The implementation stage is the stage at which you actually code your designed solution. Below are some data types used in computing.
  • Character - A symbol, letter or number, e.g 'J'
  • String - A list of characters, e.g 'Hello'
  • Integer - A whole number, e.g 3
  • Float/Real Number - A decimal number, e.g 3.14
  • Boolean - Either True or False

Data Structures

An array is a variable that can hold multiple values of one data type, e.g names = ['Ewan', 'Mark', 'Graham', 'Ava']
An array always starts at index 0 and goes up from there, e.g names[0] = 'Ewan'

Computational Constructs

Computational Constructs - the building blocks of a programming language used to create a program. Some examples are: if-else, while, for, try-except. The special name for giving a value to a variable is called assignment
  • Arithmetic Operations - A process that is carried out on an item of data, e.g +,-,/,*. age += 1, ageDiff = ageOne - ageTwo etc
  • String Concatenation - The joining of 2 strings into 1, e.g firstName = 'Ewan', secondName = 'Travers', name = firstName + ' ' + lastName
Relational Operators
  • Equals - =
  • Compared To - ==
  • Greater Than - >
  • Less Than - <
  • Greater Than or Equal To - =>
  • Less Than or Equal To - <=
  • Not Equal To - !=
Logical Operators:
  • AND - Both conditions must be true for the output to be true
  • OR - Only one condition must be true for the output to be true
  • NOT - Condition must be false for the output to be true
Conditional Statements
  • Simple Conditional Statement - if age > 18: # do something
  • Complex Conditional Statement - if age < 18 and age < 35: # do something

Questions

  • What does assignment do
  • Write assignment statements for your name and age using a programming language of your choice
  • Name 2 operations used in programming languages
  • Which type of operations produce an answer of true or false
  • What is concatenation
  • State 2 relational operators
  • Which type of operation uses NOT

Control Structures

Control Structures control the other that lines of code are evaluated in.
  • Fixed Loop - Loop code a predetermined number of times, e.g for i in range(4): # Do something
  • Conditional Loop - Only loops as long as the condition is true, e.g while pWord != 'password': # do something

Predefined Functions

  • Function - Code that has already been written & performs an action, returning a value
  • Procedure - Code that has already been written and performs an action, not returning a value
Procedures & functions are both examples of subprograms. They perform task(s) as part of a larger programmable
Both procedures & functions sometimes require parameters, this is data that the subprogram requires in order to function

Some Examples
  • len (length) - Returns the number of characters in a string or items in an array
  • round - Rounds a number to a specific number of decimal places
  • random - Chooses a random element from a list
  • range - chooses a random element within a specified range

Standard Algorithms

A standard algorithm is a programmable 'recipe' for doing certain tasks

At beginner level, these are
  • Input Validation - Making sure the Input given is acceptable
    grade = int(input('Enter Percentage: '))
    while grade < 0 or grade > 100: 
    	grade = int(input('Error - Enter Percentage: '))
  • Running Total within a loop - How far the loop has gone through
    total = 0
    points = [1,2,3,4,5,6]
    
    for i in range(len(points)):
    	total += points[i]
    
    print(total)
  • Traversing a 1D Array - Running through all values in an array
    array = ["one", "two", "three", "four"]
    for i in range(len(array)):
    	print(giant[i])

Questions

  • Name 2 types of subprogramFunction & Procedure
  • What is the difference between a procedure & a functionA procedure does not return a value & a function does return a value
  • What is a predefined functionA piece of code that can be ran and given information, returning a value as output
  • What is a parameterInformation required by a subprogram to operate


Testing, Documentation & Evaluation

Contents

Testing


Test Cases
Testing software is an important step as it helps uncover bugs and errors that would otherwise not be found. One way of doing this is test cases, this is where you test any inputs you give a program with 3 tiers.
Lets use the example of a score program that takes in a score between 0 and 50.
  • Normal - Data that you would expect to work or be acceptable an that lies within the range, e.g 2, 45
  • Extreme - Data at the lower and upper limits of the range, e.g 0, 50
  • Exceptional - Data that should not be accepted by the program, e.g -7, 'String'

Error Types
There are different error types in computing, each one points to different faults in the code, below are the main 3 at this level
  • Syntax Error - Occurs when the rules of the programming language are broken, e.g prints(len(name)) # instead of print(len(name))
  • Execution Error - Occurs whilst the program is running, e.g res = 5/0
  • Logic Error - Occurs when mistakes are made in the design of the program, the program will run but won't give the expected output

Test Tables
Test Tables are used to lay out testing data to give a visual depiction of any problems, for example

Test Table - Accepting input of a score between 1 and 99 inclusive
Category Test Data Expected Pass
Normal 19 Accepted 🗸
Normal 67 Accepted 🗸
Extreme 1 Accepted 🗸
Extreme 99 Accepted 🗸
Exceptional 0 Rejected 🗸
Exceptional 100 Rejected X
Exceptional yesterday Rejected 🗸

Documentation

Guides
There are many different types of documentation for software and hardware, but for our purposes only 2 will be described
  • User Guide - How the user can use the software effectively
  • Technical Guide - Requirements for the system, either hardware or software

Evaluation

How to Evaluate Work
Evaluation is to check the final program against the software specification made during the analysis stage.
Evaluation falls into 5 main sections
  • Fitness for Purpose - Does the program perform as specified in the software specification
  • Code Efficiency - Has made use of the correct control structures and computational constructs
  • Robustness - How well the program deals with unexpected inputs, usually determined at the testing stage
  • Readability - How easily the code is to read and understand, readability should include:
    • Internal Commentary (Comments)
    • Meaningful Variable Names
    • Indentation/White Space (Spaces or Tabs between code lines)

WEB DEVELOPMENT


Format


What is HTML

HTML stands for HyperText Markup Language and is the language used to structure web pages, HTML uses tags to give a page structure and the language is very resilient to errors. HTML however is not a programming language

Page Structure

HTML is laid out a specific way to show what each section does, below is a basic html page layout
<!DOCTYPE html>
<html>
	<head>
		<title>Webpage Title goes Here</title>
	</head>

	<body>
		<!-- Displayed Content Goes Here -->
	</body>
</html>
Lets explain what each tag represents
  • <!DOCTYPE html> and <html> - This tag tells the web browser what language you're using to structure the page. This must always be at the top of the page
  • <head> - This tag encompasses tags like the title, css, scripts & meta tags
  • <title> - This tag will be the webpages title that shows up in the window tab of the browser
  • <body> - This tag encompasses all viewable content on the webpage
A little more about tags
  • All tags have to be surrounded like this: <tagname>
  • All tags have to be opened and closed, the end tag is always shown with a />
  • All tags can be referred to as elements
This is the example of a paragraph element: <p>Paragraph</p>


Tags


Text Tags

Text Tags are used to show text on screen, there are many different types
  • <p> - Paragraph tag
  • <h1> - Header tag, this tag can go all the way up to 6, the higher the number the smaller the header
  • <br> - Break Tag, produces a line break in the text
  • <hr> - Horizontal Line tag, produces a horizontal line that can break up text density

List Tags

In HTML, there are 2 types of lists, unordered and ordered lists
  • <ul> - Unordered list, a list with bullet points for each list item
  • <ol> - Ordered List, a list with numbers for each list item
  • <li> - List Item, used to make a new item within a list
Lists are a good way of breaking up long paragraphs into short and succinct bullet points
Within a website, you can link to other parts of your website or other websites altogether using the anchor tag. This tag creates a hyperlink which you can click and navigate around.
There are 2 types of hyperlink
  • Internal Hyperlink - A hyperlink that takes you to another part of the same website
  • External Hyperlink - A hyperlink that takes you to another website
the anchor tag has an attribute called the hyperlink reference, or href for short. Below is how to structure an anchor tag
<a href='https://www.google.com'>Link</a> There are 2 different ways to declare a link
  • Absolute Addressing - The entire domain and pathname are given to the href attribute
  • Relative Addressing - Part of the domain and pathanme are given to the href attribute, relative addressing would only be used for internal links

Media Tags

Media Tags are used to embed videos, images and audio into a webpage
  • Image - <img src='image.jpg'>
    • Attributes
    • Alt - Alternative Text describing the image, displays if the image breaks
    • Height - sets the height of the image
    • Width - sets the width of the image
  • Audio - <audio src='audio.mp3' controls></audio>
  • Video - <video src='video.mp4' controls></video>
    • Attributes
    • Controls - Displays playback controls
    • Autoplay - Automatically starts playing once the page loads
    • Loop - loops the media
    • Volume - How loud the media is

Section Tag

A section tag is used to group blocks of text together and is mainly used for styling specific sections of text <section>

Link Tag

A link tag is used to link other external files to the webpage, usually css
<link rel='stylesheet' href='style.css' type='text/css'>


CSS

Contents

CSS Rules

Cascading Style Sheets (or CSS for short) helps format the appearance of webpages. These CSS files can be applied to multiple pages in a site or they can only affect a single page.
CSS structures its code like so
  • Selector - This declares which HTML elements are to be styled, this can be an element, class or ID
  • Property - This is the CSS property that is going to be edited, e.g text color
  • Value - This is the value you assign to the corresponding CSS property
  • A declaration requires a valid property value pair, a rule may contain multiple of these declarations
For example: h1 { color: blue; font-size: 12px; }
  • h1 - This is the selector
  • color - This is the property
  • blue - This is the value
  • color: blue; - This is a declaration
At beginner, you're expected to be able to use the following CSS properties
  • Text: font (font-family, font-size)
  • Color & Background Color
  • Alignment (left, right, centre or justified)
That's all you need to know for beginner level css

COMPUTER SYSTEMS

Data Representation


Binary

Binary is how computers interpret information, binary is similar to our normal number counting, but instead of using base 10 (counting in 10s) binary uses base 2 (counting in 2s)
e.g
Counting in Base 10
1000s 100s 10s 1s
5 1 2 3
(5x1000) (1x100) (2x10) (3x1)
= 5123
vs Binary
Counting in Base 2
128 64 32 16 8 4 2 1
0 1 1 1 0 0 0 1
0 64 32 16 0 0 0 1
= 113

Floating Point Representation

Floating Point Representation is a bit different compared to binary, but the rules of math still apply

Lets take the number 0.314x1025 for example
  • 314 is referred to as the mantissa
  • 25 is referred to as the exponent
  • and the x10 is referred to as the base


Graphics


ASCII

ASCII determines how a standard set of characters is stored and is text only, with no information on the size, font, color etc.
ASCII stores each character as 7 bits (or 8 bits with extended ASCII)

Bitmapped Graphics

Bitmapped Graphics use a grid of pixels to store an image, with each pixel having a set color palette.
How many colors can each bit store:
  • 1: 2 colors
  • 2: 4 colors
  • 8: 256 colors
  • 16: 65535 colors
  • 24 (true color): 16777216 colors

Vector Graphics

Vector Graphics store shape objects and their attributes, these have some advantages
  • No pixelation, independent of zoom
  • Shapes can be layered on top of each other
Vectors have a few attributes that can be changed, you should learn these
  • Fill Color
  • Line Color
  • Coordinates (position)


Computer Architecture


Basic Computer Architecture

Computer Architecture has varied over the years as computers have gotten smaller and faster, but the same base premise is the same
Computer Architecture Model

RAM

Random Access Memory (or RAM) stores programs and data whilst the computer is running
Below are some properties of RAM
  • Programs loaded from the Hard drive into RAM
  • RAM is faster to access than the Hard drive
  • Data is lost when the PC is turned off or loses power

Processor

The Central Processing Unit (or CPU) does all the sorting, searching, calculating and decision making.
The control unit controls the order in which instructions are executed.
The Arithmetic & Logic Unit (or ALU) carries out calculations and decisions
Registers are mini storage devices on the CPU, Registers usually hold:
  • The data being processed
  • The instructions being run
  • Memory addresses that need to be accessed

Fetch-Execute Cycle

The fetch-execute cycle is the steps in which the CPU takes to execute a set of instructions
For beginner level, you only need to know about the fetch request part.
  1. Processor sets up address bus with required address
  2. Processor activates the read line
  3. Instruction transferred from memory to processor by using the data bus (fetch)
  4. Instructions decoded then executed
Heres a visual depiction of this
Fetch-Execute Cycle Diagram


Compilers & Interpreters

Contents

Translation

Computers don't naturally understand high level languages, so code has to be translated into machine code that the computer can understand, this can be done through 2 different ways
  • Compiler - Compiles & runs all the code at once
    • The code runs very fast
    • Machine code isn't easily edited once compiled
  • Interpreter - Compiles & runs code one line at a time
    • Can be used to easily find bugs
    • The program runs slowly


Cyber Security


Firewalls & Encryption

A firewall prevents unauthorised access to or from a private network
Encryption is the process of putting data into a 'code' to prevent it being seen by unauthorised users