Lecture 2 introduced the first coursework (Goodoku) and discussed memory management.
Lecture 3 introduced the subject of memory management including a discussion of a C program with a space leak and the use of malloc and free in C. This lecture also introduced the concept of dangling pointers which occur when pointers are used after the addressed memory has been freed. We discussed tools such as Electric Fence which help to find memory-related faults in C applications.
Lecture 4 discussed addresses, pointers and reference types, introducing the idea of Cyclone, a type-safe dialect of C supporting a range of pointer types including fat pointers. This lecture introduced the problem of stale addresses where the address of a local variable escapes its scope, providing access to information in other functions which we might have expected to remain hidden.
Lecture 5 was on the subject of garbage collection. C provides no support for garbage collection so Cyclone uses other replacements for malloc and free which use a garbage collector. Lecture 5 discussed the interaction between the garbage collector and unsafe methods in C#, use of pinning and use of stack allocation. This lecture concluded our look at unsafe C# features with unsafe contexts such as unsafe classes.
Lecture 6 discussed strongly and weakly typed programming languages and observed that failing to initialise variables gave rise to unpredictable program behaviour. This lecture stressed the importance of types in programming languages. It discussed the role of type to separate data according to purpose. We saw that C# pointers are never initialised and when using unsafe C# code it is possible to access a variable before it is initialised. This lecture introduced the concept of type accuracy, making the case that accurate descriptions of data values reduce the amount of data validation code which must be written by the programmer.
Lecture 7 continued to discuss type accuracy and consider rules for typing arrays such as Java's covariant rule. We saw that generic collections are neither covariant not contravariant: they are non-variant.
In Lecture 8 we looked at wildcards in Java and generics more generally, giving examples of simple generic classes and methods and discussing the implementation of generics by erasure.
In Lecture 9 we considered interoperability and implementation issues for generics looking at the consequences of using erasure to implement generics in Java and comparing against generics in C#.
Lecture 10 introduced the topic of bounded polymorphism and we considered the problem of implementing a generic ordered list.
Lecture 11 compared delegates to other approaches to parameterising code by a function. We found that the function pointers used by C were not always type-safe and that functions could be called with the wrong number of parameters or the wrong types.
Lecture 12 continued with the theme of pointers and type accuracy, presenting never null pointers in Cyclone as an example of accurate pointers in programming languages. We used these to detect flaws in program logic such as forgetting to check for NULL as a possible result from functions such as fopen.
Lecture 13 discussed an alternative to manual memory management and garbage collection: the use of regions, which attempt to combine the predictability of stack allocation with the safety of garbage collection. This lecture concluded by considering region kinds, which have different properties, and confer different properties on the data stored within.
Lecture 14 considered the relative efficiency of high-level type-safe programming languages and low-level type-unsafe programming languages. A microbenchmark was used to compare the languages used in the course.
Last modified: Mon Mar 5 14:25:15 GMT 2007
Last CVS commit: Mon Mar 12 16:08:32 GMT 2007
School of Informatics, Appleton Tower, Crichton Street, Edinburgh, EH8 9LE, Scotland, UK
Tel: +44 131 650 2691, Fax: +44 131 650 6513, E-mail: firstname.lastname@example.org
Please contact our webadmin with any comments or corrections.
Unless explicitly stated otherwise, all material is copyright © The University of Edinburgh