AOP

Object Oriented Approaches to Programming
This course on object-oriented programming is divided in two different parts. The first part deals with the classical approach (class-based, message passing, static typing) while the second part presents a more general, hence more expressive, multi-paradigm one (still class-based, but with mutiple dispatch, dynamically typed, functional, and reflexive with a meta-object protocol).
Chapter 0: Introduction
- Reminder on imperative and procedural programming. Genesis, history, evolution and development of the object-oriented approach. Current state of affairs.
- Slides (fr, en)
Part One (AOP1): Classical Object Orientation
AOP1 is about the classical (industrial) object-oriented approach. This is in particular the approach of the Java and C++ languages, which are both used for illustration purposes. The characteristics of this approach are the concepts of “class” for static information structuring, “message passing” (single dispatch) for dynamic behavior modelling, all of this in the general context of statically typed languages.
We detail the historical context in which the paradigm was born, its evolution and development, as well as the fundamental concepts on which it is built. We tackle the general modelling principles of this approach, and we also exhibit its limitations, putting emphasis on the tight relationship with the underlying programming languages caracteristics.
Chapter 1: Classes and Objects
- Class-based modelling. Concept of “object”, instanciation, destruction (vs. garbage-collected languages). UML diagrams. Information scope (instance or class-wide attributes and methods) and accessibility (public or private attributes and methods).
- Slides (fr, en), code companion
Chapter 2: Static Structuring
- Relations between classes: aggregation, composition, inheritance. Inheritance specificities: sub-classing vs. sub-typing, class hierarchies (simple and multiple inheritance), abstract and final classes, information accessibility (protected attributes and methods). Problems related to inheritance: inheritance vs. instanciation, inheritance vs. aggregation, ambivalence, diamond inheritance, public and private inheritance.
- Slides (fr, en), code companion
Chapter 3: Dynamic Behavior
- Static polymorphism: overloading, masking. Dynamic polymorphism: overriding (virtual methods). Abstract methods. Interfaces vs. multiple inheritance. Limitations of the pseudo-equivalence sub-class / sub-type: covariance, contravariance, Liskov substitution principle.
- Slides (fr, en), code companion
Part Two (AOP2): Advanced Object Orientation
AOP2 is about an advanced, alternative approach to object orientation as described in AOP. 1. Although still based on the concept of ``class’’, this approach features a number of distinctive traits, in parrticular: dynamic typing, multiple dispatch, and reflexivity through a meta-object protocol. Our goal here is to demonstrate that there is no single view on object orientation (not even on the class-based version), but also that the classical approach can be seen as a subset of this more general, hence, more expressive one.
Chapter 4: CLOS, the Common Lisp Object System
- Introduction: history, distinctive traits. Classes and objects, instanciation, information scope and accessibility. Class – type integration. Inheritance: reminders and distinctive traits. Polymorphism: reminders, generic functions and methods. Covariance, contravariance, and multiple dispatch (multi-methods).
- Slides (fr, en), code companion
Chapter 5: Advanced CLOS
- Meta-object protocols: method combinations, instanciation,
eql-specializers
. Meta-classes and applications: abstract, final, singleton, and counting classes. Reflexivity and application to the elliptic circle problem. - Slides (fr, en), code companion
Chapter 6: Case Study: Binary Methods
- Comparison with the classical approach: covariance, contravariance. Resolution with the dynamic approach and multiple dispatch. User-level concept validation: introspection and meta-classes. Implementer-level concept validation: implementing an extension to the object layer.
- Slides (fr, en), code companion
Chapter 7: Case Study: Design Patterns (the Visitor)
- Introduction and history of design patterns. The visitor example in C++. Naive reimplementation in Lisp. Deconstruction of the classical approach’s idioms. Exhibition of traits that are functional rather than object-oriented. Extension to stateful visitors.
- Slides (fr, en), code companion