Skip to content

WIP: updates2026 - #177

Open
mmcleod89 wants to merge 30 commits into
mainfrom
mm_updates2026
Open

mmcleod89 wants to merge 30 commits into
mainfrom
mm_updates2026

Conversation

@mmcleod89

Copy link
Copy Markdown
Contributor
  • Adding preliminaries / CS background notes
    • Maths background
    • Data representation
    • Floating point rep is now front loaded here
    • Function Representation
  • Moving materials around to match new time table

@20DM 20DM left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting these additions together, @mmcleod89 - they all look useful to me. I've added a bunch of suggestions, nerd comments and corrections for typos etc. Happy discuss more when you had a chance to review the review 😅

Comment thread 00introCS/basicTypes.md

## Strings and Characters

A single character can be represented using `char`, which takes a single byte. For strings you are advised to use the C++ type `std::string`. In some places you will come across `char*`, an C-style array of `char`, as an alternative to C++ strings. These should only be used where necessary for compatibility. The most common place for this to come up is command line arguments for the `main` function.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
A single character can be represented using `char`, which takes a single byte. For strings you are advised to use the C++ type `std::string`. In some places you will come across `char*`, an C-style array of `char`, as an alternative to C++ strings. These should only be used where necessary for compatibility. The most common place for this to come up is command line arguments for the `main` function.
A single character can be represented using `char`, which takes a single byte. For strings you are advised to use the C++ type `std::string`. In some places you will come across `char*`, a C-style array of `char`, as an alternative to C++ strings. These should only be used where necessary for compatibility. The most common place for this to come up is command line arguments for the `main` function.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, nerd comment: char* is technically a pointer to char, not really an array. Perhaps worth reminding them that the pointer itself carries no length information and could point at rubbish...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did originally write up a bunch of stuff about pointers but I was worried that this is the prelim material and they don't know what a pointer is yet. I only really included char* because I was worried they would see it in command line arguments. Perhaps it's better to defer char* to later to avoid confusing them? Most of the time they should be using std::string anyway nowadays.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair - I suppose we would anyway cover it on the first day via a little Hello world program, so maybe we don't even need to cover it in the prereqs then.

Comment thread 00introCS/basicTypes.md
# Basic Types in Programming Languages

In order to effectively work in any programming language, we need a basic understanding of a number of fundamental types. We will give these types by the names in C++, although there are generally analogues in other languages.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should add here something like:

The size and range of some C++ types depend on the implementation. We describe common choices on modern desktop and server systems below, and mark these as "typically". Use sizeof(T) to inspect a type's storage size in bytes and std::numeric_limits<T> from <limits> to inspect its numerical properties.

?

Comment thread 00introCS/basicTypes.md

- `int`: integers that can be positive or negative, and take 4 bytes of memory.
- `unsigned int`: integers that can only be positive, and take 4 bytes of memory. Because they don't have to represent negative numbers as well, `unsigned int` can represent larger values than `int`.
- `std::size_t`: unsigned integers that can represent that size of the largest possible object; this is usually determined by the addressing on an architecture. For example, on a 64-bit system `size_t` will typically be 8 bytes. This is the standard type to use for things like indexing arrays/vectors since it can't be negative and is guaranteed to be able to represent the largest index of an element of an array.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest to add something like

Care is needed with subtraction and comparisons involving signed integers. When you only need to visit each element of a container, prefer a range-based for loop.

Comment thread 00introCS/basicTypes.md

### Floating Point Precision

Higher precision floating point numbers (like `double` as opposed to `float`) will give more accurate results when doing numerical work, but may also be slower to perform operations. Historically `double` operations have taken more time to compute than `float` operations, although this is no longer typically the case on modern CPUs. Nevertheless, if you are exploiting SIMD registers for maximal performance, fewer `double` values can fit in an available register and therefore fewer operations can be performed in a given amount of time. Some fast algorithms use single precision `float` or even half precision floating point numbers in areas where the results will not be significantly impacted by this. This is particularly common in areas like statistics and machine learning where the statistical variance is much larger than the precision of the floating point numbers. You must always bear in mind that the use of lower precision floating point types can lead to numerical instability from cancellation errors or division/multiplication by extreme values causing under or overflow. You should always have tests for robustness and precision to check that any compromises made to precision are acceptable.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Higher precision floating point numbers (like `double` as opposed to `float`) will give more accurate results when doing numerical work, but may also be slower to perform operations. Historically `double` operations have taken more time to compute than `float` operations, although this is no longer typically the case on modern CPUs. Nevertheless, if you are exploiting SIMD registers for maximal performance, fewer `double` values can fit in an available register and therefore fewer operations can be performed in a given amount of time. Some fast algorithms use single precision `float` or even half precision floating point numbers in areas where the results will not be significantly impacted by this. This is particularly common in areas like statistics and machine learning where the statistical variance is much larger than the precision of the floating point numbers. You must always bear in mind that the use of lower precision floating point types can lead to numerical instability from cancellation errors or division/multiplication by extreme values causing under or overflow. You should always have tests for robustness and precision to check that any compromises made to precision are acceptable.
Higher precision floating point numbers (like `double` as opposed to `float`) can reduce rounding error when doing numerical work, but may also be slower to perform operations. Historically `double` operations have taken more time to compute than `float` operations, although this is no longer typically the case on modern CPUs. Nevertheless, if you are exploiting SIMD registers for maximal performance, fewer `double` values can fit in an available register and therefore fewer operations can be performed in a given amount of time. Some fast algorithms use single precision `float` or even half precision floating point numbers in areas where the results will not be significantly impacted by this. This is particularly common in areas like statistics and machine learning where the statistical variance is much larger than the precision of the floating point numbers. You must always bear in mind that the use of lower precision floating point types can lead to numerical instability from cancellation errors or division/multiplication by extreme values causing under or overflow. You should always have tests for robustness and precision to check that any compromises made to precision are acceptable.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest to add something like the following for perspective:

Precision also affects how much memory a calculation needs. For example, storing an array using 32-bit rather than 64-bit numbers halves the memory needed for its elements. This can allow larger problems to fit into a GPU's limited memory and reduce the amount of data that must be moved during a calculation, potentially improving performance. The rapid growth of AI has accelerated interest in lower-precision hardware and algorithms, including their use in scientific computing. Many algorithms use mixed precision: lower precision for much of the work, with higher precision retained for sensitive steps. The aim is to reduce computing costs while still meeting the accuracy requirements of the application; this must be checked for the problem being solved.

Comment thread 00introCS/basicTypes.md Resolved
Comment thread 05libraries/sec03CppCodeDesign.md Resolved
Comment thread 05libraries/sec03CppCodeDesign.md Resolved
Comment thread 05libraries/sec03CppCodeDesign.md Resolved
- Optimisation often takes significant work: it is much slower to write a highly optimised implementation than a straight-forward one.
- Optimised code is often unintuitive and therefore harder to understand for new users. This also makes maintenance harder, especially if it is not obvious what can and can't be changed without breaking the optimisation benefits!
- Highly optimised code may not be portable, as code may be optimised for specific platforms, architectures, or even individual machines.
- KISS (Keep It Simple, Stupid) is a good principle for first drafts: focus on writing _correct_, understandable code first.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- KISS (Keep It Simple, Stupid) is a good principle for first drafts: focus on writing _correct_, understandable code first.
- "Keep It Simple" is a good principle for first drafts: focus on writing _correct_, understandable code first.

Comment thread 05libraries/sec03CppCodeDesign.md Resolved

@20DM 20DM left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting these additions together, @mmcleod89 - they all look useful to me. I've added a bunch of suggestions, nerd comments and corrections for typos etc. Happy discuss more when you had a chance to review the review 😅

mmcleod89 and others added 19 commits November 10, 2026 12:01
Co-authored-by: Christian Gutschow <64213771+20DM@users.noreply.github.com>
Co-authored-by: Christian Gutschow <64213771+20DM@users.noreply.github.com>
Co-authored-by: Christian Gutschow <64213771+20DM@users.noreply.github.com>
Co-authored-by: Christian Gutschow <64213771+20DM@users.noreply.github.com>
Co-authored-by: Christian Gutschow <64213771+20DM@users.noreply.github.com>
Co-authored-by: Christian Gutschow <64213771+20DM@users.noreply.github.com>
Co-authored-by: Christian Gutschow <64213771+20DM@users.noreply.github.com>
Co-authored-by: Christian Gutschow <64213771+20DM@users.noreply.github.com>
Co-authored-by: Christian Gutschow <64213771+20DM@users.noreply.github.com>
Co-authored-by: Christian Gutschow <64213771+20DM@users.noreply.github.com>
Co-authored-by: Christian Gutschow <64213771+20DM@users.noreply.github.com>
Co-authored-by: Christian Gutschow <64213771+20DM@users.noreply.github.com>
Michael McLeod and others added 2 commits November 10, 2026 16:24
Co-authored-by: Christian Gutschow <64213771+20DM@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants