Sunday, 20 September 2020

Computer Science Reference List

CS Reference List

This is a collection of papers, websites and books that I have found useful when researching into computer science. Mainly into programming paradigms and languages, focusing on understanding OOP


Phenomena and Concepts




Learning how objects relate to philosophical concepts and phenomena, provides a starting point to model objects.


  • Wayback machine (20/09/2020)
  • Google drive (20/09/2020)

Specialization of classes




A description of inhertiance using sets.


  • Wayback machine (20/09/2020)
  • Google drive (20/09/2020)

A Tour of C++

Blog post


Bjarne stroustrup on Procedural, Modules, ADT, Abstract types and Objects.


  • Wayback machine (all pages available 20/09/2020)

On Understanding Data Abstraction



This paper describes what the difference between an Object (OOP) and ADT (abstract data type) is.




Criteria for modularity



A white paper describing how to modularize a program.


  • Google drive (20/09/2020)


ALGOL bulletin No. 21 - AB21.3.6 "Record Handling"



An old ALGOL bulletin paper that describes records and their relation to types.


  • Google drive (20/09/2020)

Sunday, 6 September 2020

OOP Quotes 1: ADT vs Object

From: "On Understanding Data Abstraction, Revisited. William R. Cook"

 "in modern object-oriented languages, the issue boils down to whether or not classes are used as types. In a pure object-oriented style, classes are only used to construct objects, and interfaces are used for types. When classes are used as types, the programmer is implicitly choosing to use a form of abstract data type."


"To summarize, when a class name is used as a type, it represents an abstract data type"


"Object-Oriented Programming in Java

While Java is not a pure object-oriented language, it is possible to program in a pure object-oriented style by obeying the following rules

Classes only as constructors: A class name may only be used after the keyword new.

No primitive equality: The program must not use primitive equality (==). Primitive equality exposes representation and prevents simulation of one object by another. "

"Objects work with interfaces as types"

"OOP is using dynamic dispatch, ADT does not"

"ADT work with class as types"

Example ADT:


class Person {}

Person p = new Person();


struct set rep; // representation is not defined in header  

typedef struct set rep* set;
set empty();
bool isEmpty(set s);

set insert(set s, int i); 

bool contains(set s, int i); 

set union(set s1, set s2);



Example Objects:

class PersonManager {};

class PersonSystem {

    void printName(Person p) {}

    PersonManager m_manager;


Person p = new Person();


Monday, 24 August 2020

C++ Interfaces Explained

When designing a program, using interfaces improves the program by drastically lowering coupling.

This first diagram, we can see that the EntityManager depends on the Renderer class. This is bad because programs should "depend upon abstractions not concretions", if the Renderer class changes then EntityManager will break too.

Therefore we should 'fix' the Renderers interface so that other class that use the Renderer, will not have to be changed when the renderer functions change. To do this we use what is called an "Interface" class (interface in Java and C# are natively supported but not in C++). The "Interface" class is in fact a PIMPL (pointer to implementation) used to create the boundary between implementation and abstraction.

An "Interface" class in C++ is a polymorphic base class with no implementation (code,data.etc) just function signatures. The reason why it holds nothing but function signatures. One reason why an interface has no implementation is because (see example double-dispatch below) the "Interface" classes can be forward declared and linked at link time, this means the "Interface" class can't contain any implementation, only function signatures, otherwise we receive "Duplicate Symbols" error from the linker when we try to use them.

Without interface
Without the IRenderer interface

This second diagram shows the Renderer concrete class, they are exactly the same other than Renderer is replaced with the abstract polymorphic class "IRenderer" to seperate the Renderer heirachy from the EntityManager.

With the IRenderer interface

IRenderer interface /PIMPL

Although it might seem redundant to duplicate the Renderer interface as IRenderer, it is infact a cornerstone of "Designing by contract", using interfaces you can define contracts between class heirachies.

Sunday, 19 April 2020

C++ Game Project - 1 - Rendering Fonts

Figured out how to render fonts using FreeType and OpenGL.

OpenGL, C++ and FreeType
Learning Points:
  • Orthographic projections and the device coordinate system.
  • Font metrics and FreeType library.
  • Resource Pools and Factory designs.
  • GLM library.


Computer Science Reference List

CS Reference List This is a collection of papers, websites and books that I have found useful when researching into computer science. Mainl...