Advanced Object-Oriented Design and Development

Understand the key mechanisms and the essence of object-oriented design: messages, tests, hooks, design patterns, double dispatch, object creation, sharing, inversion of control and types.

  • 10 modules
  • 64 lectures
  • Self-paced
  • Quizzes & Open Badge
  • Language-independent concepts

Follow the MOOC on France Université Numérique

The MOOC is self-paced: register on FUN and start at any time. The course is in English.

  • Quizzes let you check that your understanding of each lecture is correct.
  • An Open Badge is issued on request to learners who obtain at least 60% correct answers on the quizzes.
  • All slides and videos are also freely available below, and as a full archive.

Questions? Join the Pharo Discord: there is a newbie help channel and people are friendly.

Enroll on FUN

About this MOOC

You will get to know and understand the key mechanisms and the essence of object-oriented design. Whether you are a beginner or an expert, we are sure that you will not develop the same way after following this unique lecture, built on more than 60 years of combined experience teaching object-oriented design.

Language independent

Pharo is the pedagogical vehicle, but every concept applies to any object-oriented language.

Why Pharo?

A pure object-oriented language with immediate feedback on live objects: the perfect environment to teach deep object-oriented programming.

Design exercises

From little interpreters to games and quizzes, collected in a companion exercise book.

Next level

The Pharo MOOC is not a requirement, but if you liked it, this MOOC brings you to the next level ;-)

What learners say

I love this course so much. I remember how difficult it was to understand OOD concepts in the early 2000s. There were a lot of aphorisms flowing around, but when I asked the people stating them to explain it, no one really did. It is so satisfying to see lecture after lecture explaining those object-oriented principles while refactoring examples. This is the course I wanted 24 years ago. So happy that it exists today.— bambooer
Hi, thank you for the excellent MOOC. I just completed Module 1. The quizzes really help. I am going to say this a lot. I am warning you. What a great course this is. The lectures are solid. I am working through the first exercise, and I have been learning so much and consolidating the information from the lectures along with practicing pharo. I believe this course will be my model whenever I write training in the future.— stfan10
In my opinion, this MOOC is a must-learn for any developer using Object-Oriented Programming. It teaches the essential concepts common to most OOP languages in a concise and well-paced way. The choice of Pharo as an illustrative language definitely felt appropriate, and was never an obstacle to understanding the content of the course. I would definitely recommend completing the companion exercises, whether in Pharo or your OOP language of choice.
High-level course stimulate your brain and gives you lots of inputs to go on learning more and more...
The knowledge, syllabus and pacing are excellent. Recording is of good quality (minus the occasional typos), even at an accelerated speed (I used 1.5x). Thank you so much for giving me the rationales to finally understand the OOP paradigm after years of working with it using heuristics and half-understood notions. It feels like a new beginning for me.
Modules 1-4 should be taught to and understood by anyone programming with an OOP language. I appreciate that these pieces of invaluable knowledge keep being repeated in the other modules.
My most sincere compliments. It is rare to find a course that is so specialized and practical at the same time.

Companion exercise book

We designed a set of exercises to train yourself on object-oriented design, packaged as a book. Do them in Pharo or in your object-oriented language of choice.

Download the book (PDF)

Found a mistake? Please open an issue on GitHub: it helps us improve and publish the book.

MOOC map

The map shows the modules and how they relate. See the MOOC overview as slides or video.

Map of the MOOC modules

Get started

  1. Download and install the Pharo Launcher for your OS, and create an image of the latest Pharo version.
  2. New to Pharo? Do the optional warm-up module, and execute ProfStef new go in Pharo for an interactive tutorial.
  3. Follow the modules in order: each builds on the previous ones.

Modules

64 lectures in 10 modules, plus an optional warm-up. Each lecture comes with its slides and its video. All slides are also available as a single zip.

Optional warm-upLittle Warm up with Pharo

This first optional module presents some lectures from the Pharo Mooc. It helps the reader who wants to follow the syntax used in the slides and do the exercises to learn fast Pharo. We suggest to execute the expression ProfStef new go and perform the proposed exercises.

Teaching objectives (2)
  • Pharo syntax
  • Pharo object model

Core elements — The following short videos explain the full language.

Extras — The following short videos explain some extra points.

Module 1Understanding messages

This first module revisits elementary concepts around self, super, and the power of dispatching to dedicated objects. The case study shows how to go from a monolithic design with one kind of format to the handling of optional different formats in the Pillar document compilation chain.

Teaching objectives (6)
  • Completely rethink what it means to send a message
  • Explain that sending a message is making a choice based on classes
  • Distinguish between static and dynamic approaches to inheritance
  • Understand what is to send a message and how lookup works
  • Understand deeply what super is
  • Apply the mechanics of a transformation that makes implicit behavior explicit
  • M1-1Essence of Dispatch: Taking Pharo Booleans as ExampleSlides Video
  • M1-2Essence of Dispatch: Let the receiver decideSlides Video
  • M1-3Inheritance BasicsSlides Video
  • M1-4Inheritance and Lookup: Self - Understand lookup once for allSlides Video
  • M1-5About superSlides Video
  • M1-6Reification and delegation - A case study: Microdown in PillarSlides Video

Module 2Tests

This module covers an important aspect: testing applications and how to take advantage of test driven design. It shows in particular the power of eXtreme Test Driven Design and how writing tests first and coding in the debugger is empowering the designer.

Teaching objectives (5)
  • Understand the structure and benefits of a test and specify a proper automated test
  • Identify the benefits and characteristics of a good test suite
  • Identify the benefits and apply a Test Driven Development workflow
  • Specify and apply the Xtrem Test Driven Development method with Pharo tools
  • Create a parameterized test and reuse it with specific values
  • M2-1Test 101: The minimum you should knowSlides Video
  • M2-2Tests: Why testing is Important?Slides Video
  • M2-3Test-Driven DevelopmentSlides Video
  • M2-4Xtreme Test Driven Development: Getting a productivity boostSlides Video
  • M2-5Parametrized Tests: Getting more tests out of test casesSlides Video

Module 3Hooks

In this module we will start to look at design patterns. In parallel, we will discuss a key point of object-oriented design which is how to design abstractions that are extensible using hooks. The case study is about going from monolithic to parametrized objects.

Teaching objectives (5)
  • Get exposed to design patterns
  • Use hooks to extend code
  • Analyze hook and template methods
  • Use a stream and avoid creating spurious objects
  • Move from a monolithic global design to one that can be parameterized
  • M3-1An introduction to design patternsSlides Video
  • M3-2Message Sends are Plans for ReuseSlides Video
  • M3-3Hooks and Template: One of the cornerstones of OOPSlides Video
  • M3-4Using well asString and printString: A Pharo code idiomSlides Video
  • M3-5Global to parameterSlides Video

Module 4Objects: state and behavior

In this module we will focus on basic principle showing for example the difference between data and objects. We will start also to present some design patterns such as Singleton and Decorator.

Teaching objectives (6)
  • Rethink object API
  • Distinguish between an object and a data structure
  • Identify the different syntactic forms of global variables
  • Identify the disadvantages of fat classes and replace them with class hierarchies and delegation
  • Implement the Singleton pattern, with its advantages and disadvantages
  • Apply the Decorator design pattern and identify when to use it
  • M4-1Methods: the elementary unit of reuseSlides Video
  • M4-2Objects vs. Data - An API perspective studying the class PointSlides Video
  • M4-3About global variablesSlides Video
  • M4-4Fat classes are bad - A large class vs. a class hierarchySlides Video
  • M4-5Singleton: a Highly Misunderstood PatternSlides Video
  • M4-6Decorator Design PatternSlides Video

Module 5Elementary design patterns

In this module we will present some important and simple design patterns such as composite or state. We will then propose to compare use versus inheritance a way to understand the forces in presence.

Teaching objectives (9)
  • Understand the Composite design pattern and identify when to use it
  • Use the State design pattern to design objects with many states, complex transitions between states and operations that depend on each state
  • Understand the Command design pattern and identify when to use it
  • Use a design pattern in the real world
  • Compare inheritance-based and delegation-based designs
  • Identify the benefits of using objects to represent complex algos
  • Recognize when it is preferable to use objects rather than lexical closures
  • Identify the use of NullObject design pattern and the benefit of object state initialization
  • Manage methods with a large number of arguments and design fluid APIs

Module 6About double dispatch

This module presents the double dispatch mechanism and the Visitor design pattern which is based on it.

Teaching objectives (7)
  • Use the power of sending messages to get a more modular design
  • Apply Double dispatch to non-symmetrical domains
  • Identify the double dispatch mechanisms and use them with a simple example
  • Apply the Visitor design pattern and identify when to use it
  • Use and implement the possible variations of the Visitor design pattern
  • Question the return of values, numbers vs. symbols
  • Use the double dispatch mechanisms in more complex cases
  • M6-1A double dispatch starter: Stone Paper ScissorsSlides Video
  • M6-2Double dispatch: Does not have to be symmetricalSlides Video
  • M6-3a Die + a DieHandle: Practicing dispatch moreSlides Video
  • M6-4Visitor: Modular and extensible first class actionsSlides Video
  • M6-5Some discussions on VisitorSlides Video
  • M6-6Stone Paper Scissors: The case of resultsSlides Video
  • M6-7Double Dispatch: Adding numbers as a KataSlides Video

Module 7Creation

This module focuses on patterns to create and initialize objects.

Teaching objectives (8)
  • Identify the benefit of delaying the initialization of an object until it is needed
  • Analyze the impact of the granularity of hooks
  • Use a mechanism for specifying extensible class names by default to avoid hardcoding them
  • Use the delegation of actions and accumulator concepts
  • Use of behavior delegation to avoid programming complex conditions
  • Use the Builder design pattern to create complex object graphs
  • Identify and use different API design alternatives for Builder Patterns
  • Explain the relation between super and lookup when sending a message
  • M7-1About Null Check: The case of lazy initializationSlides Video
  • M7-2Customization degree of hooks: Class vs. instance hooksSlides Video
  • M7-3DieHandle new vs. self class new: When classes are first class citizenSlides Video
  • M7-4Delegation of actions and accumulator: Form validation as an exampleSlides Video
  • M7-5Behavior delegation at work: The case of the class printerSlides Video
  • M7-6Builder Design Pattern: Encapsulating object creationSlides Video
  • M7-7Builder API variationsSlides Video
  • M7-8Did You Really Understand Super?Slides Video

Module 8Sharing

This module presents different techniques and design patterns to share objects.

Teaching objectives (7)
  • Use a shared variable and analyze its impact on the instances of a hierarchy
  • Misunderstood resource sharing with instance-specific information to extend the spectrum of object sharing
  • Group and share constants between multiple classes
  • Customize hooks to define and reuse magic literals to avoid hardcoding them in the code
  • Identify the implementation compromises for the Flyweight pattern
  • Represent attributes that are common to a type of objects in a more flexible way
  • Share objects while allowing properties to be modified

Module 9About Inversion of control / Registration

In this module, we present the law of demeter and different techniques to achieve Inversion of control.

Teaching objectives (6)
  • Reduce the impact of change in complex systems by following Demeter's Law
  • Use class methods to create extensible designs
  • Use an explicit registration mechanism and explain its benefits
  • Identify a monolithic architecture and propose different solutions to transform it into a more modular one
  • Analyze an existing design and remodel it to make it modular using message dispatch
  • Understand object programming as opposed to a design approach that focuses more on classes than on objects
  • M9-1About coupling and encapsulationSlides Video
  • M9-2Class Methods At WorkSlides Video
  • M9-3About Registration: When class method-based registration is too muchSlides Video
  • M9-4Application settings: From a monolithic to a modular architectureSlides Video
  • M9-5Learning from a Sokoban implementationSlides Video
  • M9-6Class vs. Object-Oriented ProgrammingSlides Video

Module 10About Types

This modules focuses on typing and their relation with object-oriented design.

Teaching objectives (5)
  • Disprove the common misconception that instance variables must be private
  • Explain the difference between Subclasses and Subtypes
  • Describe the relationship between sending a message associated with the selection of lookup methods and static types
  • Explain the need for interfaces in statistically-typed languages and their uselessness in dynamically-typed languages
  • Explain the pros and cons of using defensive checks in programming

Resources

Free online resources are on the Pharo documentation page. We recommend the updated Pharo by Example, the Pharo cheat sheet, and Learning Object-Oriented Programming, Design and TDD with Pharo on books.pharo.org.

The authors

Stéphane Ducasse

Stéphane Ducasse

Stéphane Ducasse is directeur de recherche at Inria. He leads the RMoD team. He is expert in two domains: object-oriented language design and reengineering. His works on traits have been introduced in AmbientTalk, Slate, Pharo, Perl-6, PHP 5.4 and Squeak. They have also influenced JavaScript, Scala and Fortress. Stéphane is also expert on software quality, program understanding, program visualisations, reengineering and metamodeling. He is one of the developers of Pharo. He is also one of the developers of Moose, an open-source software analysis platform. He created Synectique a company building dedicated tools for advanced software analysis. Stéphane wrote several books on programming learning and other topics such as web programming.

Luc Fabresse

Luc Fabresse

Luc Fabresse is currently professor in computer science at IMT Nord Europe. His researches focus on dynamic and reflective languages such as Pharo to better support programming in the context of mobile robotics and IoT. It involves deployment, code update, memory management and bootstrapping. He also works on fleet of collaborating mobile robots involving challenges such as: localization, navigation and distributed coordination. Luc's long-term vision is to be able to use Jedi mind trick on mobile robots ;-) Meanwhile, Luc gives many computer science lectures, co-organizes events (technical days, conferences,...), promotes Smalltalk (ESUG board member) and participates to its open-source implementation Pharo.

Guillermo Polito

Guillermo Polito

Guille Polito is a permanent researcher at Inria of the University of Lille, within the EVREF team. Guille’s main research interests are programming language implementations, Virtual machines, testing, programming tools, and modular systems. He has more than 15 years in teaching advanced OOP.

Pablo Tesone

Pablo Tesone

Pablo Tesone is Pharo consortium engineer. He holds a PhD in Computer Science from the University of Lille. Prior to that, Pablo was during 10 years an engineer in large corporates. Pablo has a large spectrum of skills ranging from low-level assembly to high-level reflective systems. He is one of the engineers behind the Pharo Virtual machines. He is the father of stateful traits as available in Pharo. He has more than 15 years in teaching advanced OOP.

The partners

logo Inria logo Université de Lille logo IMT Nord Europe logo Unit