Course Notes & Articles

Additional Information, that Hopefully Matters

These are supplementary notes mainly for Incus Data course attendees. We have made these notes available to a wider audience as an experiment, to gauge if they add some value for you. In addition to course notes, we have included an eclectic collection of code examples, articles and other miscellanea from our trainers & staff. More…

Material may contain inadvertent errors, omissions, or be in draft form — caveat lector.

NO WARRANTIES, EXPRESS OR IMPLIED, ARE PROVIDED

ISO C99/11

ISO C++11/14/17

Getting Started with GCC
[2024-09-28] C99/C++ Compilation Background, Setup & Tools.

This document describes the first steps in creating C99/C++ programs, with the GNU C++ com­pi­ler. Apart from directory and path specifications, these steps are applicable to MSYS2, Cyg­win, Mingw-W64, Linux, Unix, Mac OS X — basically anywhere GCC is available.

Preprocessor
[2023-06-07] C/C++ Preprocessor Features

The C preprocessor is also used by C++, and is an indispensable phase in the compilation of programs in these languages, due to their separate compilation design. Most examples are in C, but this article also mentions the preprocessor in relation to C++.

Addressing Pointers
[2023-06-03] Concepts of, and Operations on, Pointers

C's pointer types and operations on them, are vital. Mis­un­der­stand­ing them often causes pro­gram fail­ures. Master­ing these aspects is in­valuable for C/C++ pro­gram­mers. This dis­cus­sion covers all C99 rules for point­ers, which also applies to C++, but is not ne­ces­sa­ri­ly a be­gin­ner's guide. C++ ref­e­ren­ces are not covered.

Pointer & Array Summary
[2018-05-24] C Types and Operators Related to Pointers

Pointers (variables of a pointer type) and arrays (which result in a pointer type), are often mentioned together. This is not because they are similar, but because certain rules make it possible to apply the same operators to both typees. This is a summary of the main points.

Operator Precedence
[2017-11-18] Relative Rank of C99 Operators

C99 has fewer operators than C++, but the same operators have the same precedence re­la­tive to each other. The precedence by itself is not sufficient, which is why both C99 and C++ also provide every operator with an association attribute. The association describes whet­her the operators associate with their operands from left-to-right (the norm), or from right-to-left.

Exceptions in C++
[2021-10-20] Fundamentals of C++ Structured Exception Handling

Like many modern languages, especially object-oriented languages, C++ provides a syntax and mechanism for handling runtime errors in a structured way, using a very common “throw-catch” paradigm — using the term exception as an abstraction for the concept.

Class Foundations
[2019-03-28] Concepts, Overview and Syntax of C++ Classes

C++ is an object-oriented language, even if the use of object-oriented features is optional. To implement object-oriented designs us­ing classes, an understanding of the es­sen­tial language components and syntax specific to C++ is required. This constitutes the minimum syntactical knowledge required before embarking on class templates.

Operator Precedence
[2019-02-18] Concepts and Ranking of C++ Operators

C++ has more op­e­ra­tors than C — it is actually a superset of the C op­e­ra­tors. This document is sim­ply a convenient quick reference, with a few notes regarding some important op­e­ra­tors and the types of their operands. Operator overloading is also summarised, along with the concepts and terminology related to operators and C/C++ expressions.

C++ Circle Code Reorganisation
[2017-11-18] Simple Reorganisation of Circle Calculator

Algorithmically similar programs, with the same functionality, can be organised differently. Some of the various organisational possibilities are demonstrated here, culminating with the most common practical organisation: multi-file projects. We have also included an option using simple encapsulation.

Reference to Array
[2017-11-18] C-style Array Variables, Parameters and References

This article discusses pointer-to-array and reference-to-array types in C++. In particular, we pay attention to at least one useful application of this in C++11 and newer, which will reduce dependence on the C preprocessor.

RTTI Fundamentals
[2017-11-18] Run-Time Type Information in C++

C++ offers some minimal dynamic type inspection under the umbrella term “RTTI”. Most pro­grams do without, and several compilers either turn it off by default, or have a compile time option to en/disable it. There are not many options, and they are briefly presented here.

Stack Class Example
[2020-03-19] Simple Stack Abstract Type Implementation

Encapsulation is a useful feature of object-oriented languages, even without considering inheritance or polymorphism. This attempts to summarise many of the C++ syntax features related to encapsulation, using a simple Stack class, including a template version.

C♯, Roslyn & .NET

C♯ Types and Literals
[2021-11-29] Type Concepts, C# Pre-Defined Types & Literals

C# is statically typed. This means types for all values must be known at compile time. Types determine the storage, behaviour and attributes of values, so every value has a type. Literals are simply constant values, and as such must also have a type. Some .NET types are so com­mon, that C# provides synonyms (aliases) for some, since it has not types of its own.

C♯ Encapsulation Syntax
[2020-04-01] Encapsulation of a Circle Example

Encapsulation is one of the main OOP concepts, which is summarised here, using a simple Circle class. It is kept simple from an algorithmic perspective, so that the logic does not ob­scure the syntax. We use it to illustrate many general object-oriented programming fea­tur­es and syntax, as found in most OO languages, but also .NET & C# specialities, like properties and in­dex­ers (special kind of properties), which are relatively rare in other OO languages.

C♯ Program Organisation
[2017-11-27] Fundamental C# Program Structure with Examples

Different structural organization of the same program behaviour, using circle calculations. Example programs, with commentary, performing the same tasks: asking for a radius, which it inputs and validates, followed by printing the area and circumference of a circle with that radius. Each is however organised differently, to illustrate the various options available. We start with the simplest organisation, and ends with an Object Oriented (OO) version, which obviously can only be appreciated fully, if you have some OO background.

Perl 5

Getting Started with Perl
[2019-12-12] Perl Background, Features and Running Scripts

This is to enable a Perl newcomer to get started, using either Linux, MacOS, Windows, or a flavour of Unix. It introduces some global Perl concepts, terminology and good programming prac­tic­es, in a modern context.

Scalar Values and Variables
[2017-12-22] Values and Variable Definitions in Perl

After Getting Started with Perl, the next step is to learn about constants, literals and variable definitions. This part focuses on scalar (single value) literals and variables, using numbers and strings.

Java™ Platform

Review of Generics
[2018-05-21] Review of Generics in Java

Generics were introduced in Java 5 and are used extensively for type safe collections. With the inclusion of functional programming in Java 8, generic usage has expanded into lambdas and higher-order functions, which are almost impossible to use without a good knowledge of generics.

Introduction to Lambdas
[2018-05-21] Introduction to Functional Programming in Java using Lambdas and Streams

Lambda expressions and streams are without a doubt the most important features of Java 8. This page introduces the concepts of lambdas and streams, and includes comprehensive examples.

Getting Started with Java 8
[2017-12-23] Java Overview with Relocatable JDK 8

This is to enable a Java™ newcomer to get started, using either Linux™, MacOS™, Windows™, or a flavour of Unix™ — wherever Java runs. It does in addition show how to get a re­lo­cat­ab­le JDK8 running without Administrator privileges on Windows. We avoid JDK9 since it is larg­er, less used, and is not a requirement for learning the Java language.

Types, Values and Variables
[2017-12-28] Primitive Types, Literals and Variable Definitions

All Java programs require values. Every value has a type. Some types are primitive, but the ma­jo­ri­ty of types are reference types, i.e. class types. Specialised, but simple types, include enu­me­rat­ed types. We start by looking at some useful types, then we discuss literals of that type, followed by some practical variable definition syntax and use.

Statements and Functions
[2017-12-29] Selection, Iteration and Method Definitions

Non-trivial programs require a way to make decisions, and to repeat a set of instructions — control flow. To fa­ci­li­tate these requirements, Java provides a number of selection and it­e­ra­tion state­ments. Pro­grams also need a way to group repeatable code, which are functions, but commonly called methods because of Java’s object-oriented nature.

Miscellaneous Topics

GNU Make Fundamentals
[2024-10-04] Concepts and Principles of Program Building

Although newer build systems exist, GNU Make is ubiquitous, and it does not hurt pro­gram­mers to be, at least superficially, aware of the fundamental concepts and features of Make. This article does not delve into the more advanced features, but should never­the­less pro­vide enough material for small and medium projects. The examples are all for C99 (with commands using GNU's gcc).

Regular Expressions
[2022-03-02] Fundamental Concepts of Text Pattern Matching

Regular expressions are everywhere — if you know where to look. They are a powerful and ver­sa­tile way to extract in­for­ma­tion and manipulate text. This functionality is included in most good pro­gram­mer's editors, dedicated command line utilities like grep, and even word pro­ces­sors. Yet we still find that many programmers have little or no skills in this area. This is an introduction to the basic concepts and syntax of regular expressions.

Object Files Overview
[2020-06-30] Fundamental Features and Structure of Object Files

Natively compiled languages like C, C++, and others, generate object files, and depend on a linker to produce an executable. While object files may be relatively portable, executables are native to the target operating system. Programmers using compiled languages, should have some un­der­stan­ding of object files, even if simplified.

Relocatable Apache & PHP7 on Windows
[2019-06-18] Process to Create a Relocatable Apache 2.4 with PHP 7.3

Several packaged versions of Apache and PHP (often bundled with MariaDB or MySQL) are avail­able. You may, however, want more control, or to understand how to create your own version. This document describes the process to create a relocatable (portable) development environment with Apache and PHP.

In Defence of ++i
[2019-02-29] Pre-increment vs Post-increment Operator in Loops

When last did you see ++i in a C, C++, C#, Java, or JavaScript program? On the other hand, you would have seen i++ numerous times. Why is this the preferred choice?

Relocatable Node.js on Windows
[2018-01-11] Process to Create a Portable Node Environment

Node.js, with its V8 JavaScript Engine has proven to be remarkably resilient, with regular updates and improvements. Its success, in no small part, assisted by the Node Package Manager (NPM). The process described here, will create an xcopy-deployable (relocatable / portable) Node and NPM environment, suitable for any Node development, without affecting the Windows Registry, or other Node environments. It can also be used for cross-platform Electron GUI development.




More About This Site

DESIGN— This is a lightweight static site to disseminate information efficiently, not pre­sent a cor­po­rate presence — no heavy graphics, huge CSS, or JavaScript frameworks. No cookies, ad­ver­tise­ments, or tracking of any kind. But we do use web fonts, since mixing mono-spaced fonts aesthetically with running text, is pro­b­le­ma­tic if we depend on client-side fonts only. The layout has been kept re­la­tive­ly simple, so it renders reasonably on mobile devices with modern browsers.

PANDOC— Pages are created from Markdown files, using Pandoc and its Markdown ex­ten­sions. Cus­tom templates and style sheets were developed. On this site, the style sheets and web fonts are external, so your browser may cache it, reducing traffic. We can also create self-contained HTML pages where all resources are embedded using data URIs. These we normally release to attendees on our courses.

UPDATES— Material is regularly either added, or updated. The date associated with each page in­di­cat­es its last update, not necessarily the date of publication. The same applies to this front page.