Please enable JavaScript.
Coggle requires JavaScript to display documents.
Advanced Higher Computing (Software Design and Development (Design (User…
Advanced Higher Computing
Software Design and Development
Design
Understand design techniques
Pseudocode
Text based design notation showing the main steps and stepwise refinement. It is English like but is structured in a way that clearly identifies constructs
UML
Graphical standardised design language that provides a clear visual representation of the system making that system easier to understand and maintain
Class Diagrams
Array of objects
Constructor
Inheritance
Public and Private
Methods
Instance variables and data types
Class name
Structure diagrams
A visual technique which repeatedly breaks the problem into smaller, more manageable tasks using symbols going top to bottom
Implement efficient design solutions to a problem using pseudocode showing:
The data flow
What data is used in the program
Refinements
The main steps broken down into more detail
Top level design
The main steps
User interface design wireframe
Inputs
Validation
Visual Layout
Underlying Processes
Outputs
Implementation
Data Types and Structures
Describe, Exemplify and Implement
Parallel 1D arrays
Structure that contains multiple arrays, all of the same size, where the array elements are related to each other
Records
Stores related data of different data types
Arrays of records
Array that stores multiple records
2D arrays
Array that can be visualised as a grid with rows and columns
2dArray = [[0,0,0,0,0]]*10
_
columns___rows
[0,0],[0,1]
Array of objects
Array that stores multiple objects
Describe and Exemplify
Linked lists
Set of items organised sequentially like an array but where each item includes a link to the next item in the list
The size is not fixed and can grow and shrink during execution
It is flexible as the order of items can be changed without actually moving any data around, just the links between them
Much more memory efficient than an array because it only needs to be as large as the number of items to be stored, not as large as the total possible number of items to be stored
Types of linked lists
Single: Nodes have a data item as well as a pointer to the next field. The last node may contain a null pointer
Circular: This is when the last node will point to the first node in the list
Double/Doubly: This is when each node will have a pointer to the next AND previous nodes
In order to reach a particular node, you have to traverse the linked list in order to reach a particular node, cannot index
Requires storing of additional pointers but are much more efficient in terms of memory and processor usage
Algorithm Specification
Binary search
A binary search algorithm works by splitting the list in two until the item is found:
Generally faster than a linear search but the list has to be sorted first, linear list doesn't
SET found = FALSE
RECEIVE Goal FROM (INTEGER) KEYBOARD
REPEAT
SET middle =INTEGER((startpos+endpos)/2)
IF array(middle) = Goal THEN
SET found = TRUE
ELSE IF array(middle) < goal THEN
SET startpos = middle + 1
ELSE
SET endpos = middle - 1
UNTIL found = TRUE OR (startpos>endpos)
Insertion sort
Builds the list one element at a time by storing the current value to be inserted and comparing it to the next element. When the stored value is greater, it is shifted one element to the right. When the stored value is less it is placed at that point.
FOR index = 1 TO length(list) - 1
currentval = list[index]
position = index
WHILE position > 0 AND (list[position - 1] > currentval)
list[position] = list[position - 1]
position -= 1
END WHILE
SET list[position] = currentval
END FOR
records/classes
Change while line to:
WHILE position > 0 AND (list[position - 1].name > currentvalue.name)
2D array
Change while line to:
WHILE position > 0 AND (list[position - 1][0] > currentvalue[0])
Bubble sort
Compares adjacent items, largest values will move up to the top, repeat the process from the beginning of the list with the unsorted part of the list and stops when no further swaps take place
Bubble sort using swap flag instead of fixed loop:
DECLARE swaps INITIALLY TRUE
DECLARE outer INITIALLY length - 2
WHILE swaps AND outer >= 0 DO
SET swaps TO FALSE
FOR inner FROM 0 TO outer DO
IF list[inner] > list(inner + 1) THEN
SET temp = list[inner + 1]
list[inner + 1] = list[inner]
list[inner] = temp
SET swaps TO TRUE
END IF
END FOR
SET outer TO outer - 1
END WHILE
Bubble sort using fixed loop - will continue even if list is fully sorted
FOR i FROM length - 2 TO 0 STEP -1 DO
FOR counter FROM 0 TO i DO
IF list[counter]>list[counter + 1] THEN
SET temp TO list[counter + 1]
SET list[counter + 1] TO list[counter]
SET list[counter] TO temp
END IF
END FOR
END FOR
Bubble sort with records/classes
temp = record[inner]
The whole record is being swapped and not individual properties
Object Oriented Programming
Methods - Any operation that an object (based on a class) can perform
Constructor method - Method that is executed when an instance of a given class is created
Constructor methods initialise the instance variables of the new object
Can only run once when a class is created
Will run before all other code related to the class
It will ensure that a class is initialised using any supplied parameters
Defining basic constructor method:
CLASS BankAccount IS {STRING PIN, STRING AcctNumber, STRING Holder, REAL Balance, REAL Intrate
Calling the constructor method:
account = BankAccount("0739","893028","Joe Smith",400,1.0)
Encapsulation - The primary method by which the properties/instance variables can be modified
Setter (Mutator) method - Used to set a variable for a property within a class
The
deposit
method will increment the balance property by the supplied parameter
amount
PROCEDURE deposit(amount)
SET THIS.balance = THIS.balance + amount
END PROCEDURE
Getter (Accessor) methods - Used to return the value for a property within a class
The getBalance method will return the balance property
FUNCTION getBalance() RETURNS INTEGER
RETURN THIS.balance
END FUNCTION
Getter methods are
functions
as they will return the value to be assigned:
print("Your balance is" + str(mainaccount.getBalance())
Inheritance
Some classes will share characteristics with others but have their own individual properties/methods
Object Oriented Programming allows a class to inherit properties and methods from other classes
CLASS mountainBike INHERITS bicycle WITH
(INTEGER gear, INTEGER speed)
METHODS
CONSTRUCTOR (STRING Value)
DECLARE THIS.suspension INITIALLY Value
END CONSTRUCTOR
END CLASS
When the two classes are created they can be known as derived or sub classes
Polymorphism
Polymorphism is when we ask multiple object to perform the same operation but the action executed by each object
will be different
Example: A students wage will be calculated differently to a standard employee (student wont pay tax)
So the derived/subclass will override the inherited method with its own version
The same method will call its own function depending on the class.
OVERRIDE FUNCTION calculateWages() RETURNS REAL
SET wages TO THIS.hourlyrate * THIS.hoursworked
RETURN WAGES
END FUNCTION
Testing
Component testing:
Testing individual components without integrating with other components during development of the solution
Evaluation
Evaluate solution in terms of:
Usability
Intuitive design: Is it easy to understand?
Ease of learning: How fast it takes a new user to accomplish basic tasks
Efficiency of use: How fast a user can accomplish tasks
Memorability: After use, how well can the user remember it for effective future visits
Error frequency and severity: How often users make errors while using the system, how serious the errors are, and how users recover from the errors
Subjective satisfaction: If the user likes using the system
Efficiency
Have loops been used to reduce amount of code?
Have arrays been used instead of many variables where possible?
Have selection statements that will only make comparisons until a solution is reached been used?
Database Design and Development
Design
Entity relationship diagrams with three or more entities indicating:
Entity name
Entity type(strong, weak)
An entity that does not have a primary key is weak, and it depends on the existence of a strong entity
Attributes
Relationship participation (mandatory)
Name of relationship
Cardinality
Implementation
SQL Operations:
CREATE Statement
CREATE DATABASE database_name;
CREATE TABLE table_name(
) ENGINE=InnoDB;
Constraints
Primary key:
playerID INT NOT NULL PRIMARY KEY,
Foreign key:
FOREIGN KEY (fundraiserID) REFERENCES fundraiser(fundraiserID)
ON UPDATE CASCADE
ON DELETE CASCADE,
Not null:
name VARCHAR(30) NOT NULL,
Auto increment:
sponsorID INT NOT NULL AUTO_INCREMENT,
Check:
CHECK (Age>=18)
DROP Statement
Drop Database:
DROP DATABASE databasename;
Drop Table:
DROP TABLE table_name;
Having clause of the select statement. The HAVING clause was added to SQL because the WHERE keyword could not be used with aggregate functions.
HAVING COUNT(CustomerID) > 5;
Subqueries used with the where clause of select statements
SELECT student.studentid, student.name, marks.total_marks
FROM student, marks
WHERE student.studentid = marks.studentid
AND marks.total_marks >
(SELECT total_marks
FROM marks
WHERE studentid = 'V002');
Data Types:
VARCHAR
INTEGER (INT)
FLOAT
DATE
TIME
Logical Operators
IN
TRUE if the operand is equal to one of a list of expressions
NOT
Displays a record if the condition(s) is NOT TRUE
BETWEEN
TRUE if the operand is within the range of comparisons
EXISTS
TRUE if the subquery returns one or more records
ANY
TRUE if any of the subquery values meet the condition
Testing
SQL implemented tables match design
SQL operations work correctly
Evaluation
How accurate is the output
Web Design and Development
Design
PHP
Assign form data to server-side variables
$_get()
HTML
<form action="getform.php" method = "get">
PHP
$name = $_GET['name'];
Not secure as the submitted form data is in the URL in plain text
$_post()
Data is re-submitted and is more secure as the parameters are not stored in browser history or URL
HTML
<form action="postform.php" method="post">
PHP
$name = $_POST['name'];
Open and close connection to database server
mysqli_close()
mysqli_close($connection);
mysqli_connect()
$host = "…";
$username = "…";
$pword = "…";
$database = "…";
$connection = mysqli_connect($host, $username, $pword, $database);
die() - display message and exit the script
die("Unable to connect to $site");
Execute SQL Query
$querystring = "SELECT *";
mysqli_query($connection, $querystring);
Format Query Results
echo"--text--";
$row = mysqli_fetch_array($result, MYSQLI_ASSOC))
$row_count = mysqli_num_row($result);
Software, Database and Web Design and Development
Analysis
Identify the purpose and functional requirements of a problem that relates to the design and implementation in terms of:
Outputs
What will be displayed
Processes
Calculations
Inputs
What the user will enter
Feasibility studies
Economic
Is it possible to complete the project with the budget available or is the cost of creating the project justified by the financial reward of doing so
Time
Is there enough time to complete the project, are the right people and resources available when required to deliver the project on time
Legal
Can the solution be created and adhere to existing laws
Technical
Is it technically possible to create a solution with the available technology
User surveys
When the opinion of multiple users is required it is often easier to create a survey or questionnaire which will capture the information that the project team require
Planning
Resources
List of resources that are required e.g. people, equipment, new knowledge etc.
Gantt Charts
Used to plan and schedule projects involving several concurrent tasks
Scheduling
Scheduling involves making sure that no team is left idle waiting for another team to finish their part by listing all of the tasks that need to be completed to deliver the project
Requirements specifications
Scope, boundaries and constraints
Scope clarifies what the project must cover
Boundaries clarify what the project will not cover
Constraints are restrictions that apply to the development
Functional requirements
Where you specify inputs, processes and outputs
End-user requirements
Describe what users expect to be able to do with the system
UML Diagrams
Actors
Individuals who interact with a system in a Use Case Diagram
Use case
Approach to identify, clarify and organize system requirements. Made up of sets of possible sequences of interactions between systems and users in a particular environment and related to a particular goal
Relationships
How everything is connected