Skip to content
UoL CS Notes

Home

This website houses notes from my studies at the University of Liverpool. If you see any errors or issues, please do open an issue on this site's GitHub.

Source Code Control

COMP285 Lectures

These tools allow us to keep track of changes to code and roll back any part, of any file, to any time in history. Available Tools SVN Git Perforce (Commercial) Documentation This module will look at SVN, the documentation can be found here: https://svnbook.red-bean.com/en/1.7/index.html For documentation on git see here:...

Read More

Introduction to C++

COMP282 Lectures

Hello, world! C is also valid C++ code: #include <stdio.h> int main() { printf("Hello World!\n"); } but we can also use C++ features: #include <iostream> int main() { std::cout << "Hello World!" << std::endl; } Header Files We can use C header files in C++ but there are often C++...

Read More

The PDO Class (Databases in PHP)

COMP284 Lectures

The PHP Data Objects (PDO) extension defines an interface for accessing databases in PHP. Connections We create a connection to the database server by creating an instance of the PDO class. We can use the following constructor to this: $pdo = new PDO(dsn, username, password, options); The connection remains open...

Read More

Dynamic Memory Allocation, Stack & Heap

COMP281 Lectures

C Memory Management So far we have seen: Static-duration Variables (Allocated in Main Memory) Automatic-duration Variables (Allocated on the Stack) There are two issues with these types of variables: The size of the allocation must be compile-time constant. Their persistence cannot be manually controlled. Dynamic Memory Allocation Dynamic memory is...

Read More

Custom Types, String Functions & Storage Classes

COMP281 Lectures

struct struct is a user-defined datatype. It is used to construct complex datatypes from existing ones. struct Syntax struct [struct_tag] { /* member variable 1 */ /* member variable 2 */ /* member variable 3 */ }[struct_variables]; // <-- remember the semicolon struct_tag - The name for the structure (optional)....

Read More

Divide & Conquer Tutorial

COMP202 Tutorials

Running Time Alternate Method Instead of using the method stated here we can use this easier method instead for: \[T(n) = aT\left(\frac n b\right) + f(n)\] where: \[f(n) = O(n^d)\] We can then use the following cases: \[T(n) = \begin{cases} O(n^d) & \text{if } d>\log_ba\\ O(n^d\log_bn) &\text{if } d=log_ba\\ O(n^{log_ba})...

Read More

Testing Principles

COMP285 Lectures

Testing shows the presence of errors; not their absence. Exhaustive testing is not practical in most cases. Test early and regularly to avoid bug masking and multiple defect relations. Errors are not evenly distributed: 20% of modules generally contain 80% of errors. Pesticide Paradox Unless tests change they often become...

Read More

Capturing JUnit Test Results

COMP285 Lectures

Generating Reports Ant Formatters Ant has three types of formatter for the <junit> task: brief plain xml If we set usefile=true then each test case will generate it’s own file. We can also set printsummary=false if we don’t want this output on the command line. You can also use multiple...

Read More

PHP Classes & Objects

COMP284 Lectures

Defining Classes Classes are defined like so: class identifier { property_definitions function_definitions } Function definition may include the definition of a constructor. An object of a class is created using: new identifier(arg1, arg2, ...) The definition of a class typically looks like so: class identifier { # Properties vis $attrib1...

Read More