Object-Oriented Programming, Design with TDD in Pharo

About this course

This lecture will teach you the way program with live objects. We use Test Driven Development and show Object-Oriented Design using multiple examples.

Object-oriented programming is more than just writing algorithms. It is identifying objects, defining the behavior of such objects and how they collaborate together. Object-oriented design experts think in terms of responsibilities and collaborations that an object has. In addition finding a good design is a challenging task that depends on the context and often there is no such thing that the perfect correct solution. There are tradeoffs. Therefore good design is often the result of an iterative process. In this course we will follow the expression: "Designing starts when the program compiles" it means that we will first get a first version and think about it and since we will have written tests we will be able to change the design and improve it. This way you will learn by doing.

In this lecture we will focus on object-oriented programming concepts:

…and on object-oriented design concepts:

We decided to use Pharo. Pharo is not mainstream but it is used in many Universities in the world to teach object-oriented programming because it is one of the best language to grasp the complex design forces that makes good design. Pharo syntax is small and Pharo model is pure and elegant. What you will learn can be applied to any object-oriented programming language. more…

Pharo is a pure object-oriented programming language in the tradition of Smalltalk. It offers a unique developing experience in constant interaction with live objects. Pharo is elegant, fun to use and very powerful. It is very easy to learn and enables to understand advanced concept in a natural way. When programming in Pharo, you are immersed in a world of live objects. You have immediate feedback at any moment of your development on objects representing web applications, code itself, graphics, network…

Throughout this lectures you will:

  • learn how to program in Pharo,
  • be immersed in a live environment and live a new programming experience,
  • develop a web application to apply the different aspects of Pharo presented in the course.

This lectures also focuses a different vision of the fundamental principles of object-oriented programming mainly polymorphism and late binding.

Each week is composed of several sequences containing several lectures and their slides and associated videos. In addition videos proposing application exercises and programming demonstrations are available.

Resources

In this lecture we use the following resources

Exercises

In this lecture you will have to do the following exercises to get started. There are not associated with a given week so proceed as you want. You can find other exercises in the Learning Object-Oriented Programming and Design with TDD in Pharo book. Miniprojects are described here.

Week 1: Welcome on Board and Syntax Discovery

  1. [Lecture] W1S00-Intro-Objectives
  2. [Lecture] W1S01-What is Pharo?
  3. [Lecture] W1S02-Pharo Vision
  4. [Lecture] W1S03-FirstLookAtClassObjectMethods
  5. [Lecture] W1S04-PharoModelInaNushell
  6. [Lecture] W1S04-TestIntroduction
  7. [Lecture] W1S05-PharoSyntaxInANutshell
  8. [Lecture] W1S06-Blocks
  9. [Lecture] W1S07-Basic-Blocks-Loops
  10. [Lecture] W1S07-BasicBooleansAndCondition
  11. [Lecture] W1S08-Loops
  12. [Lecture] W1S10-ClassAndMethodDefinition
  13. [Live Exercise] Selecting and executing expressions (check the subtitles here )
  14. [Live Exercise] Syntax Highlighting gives Feedback (check the subtitles here )
  15. [Live Exercise] Learn Keyboard Shortcuts (check the subtitles here )
  16. [Live Exercise] Learn Pharo with Prof Stef (check the subtitles here)
  17. [Exercise] Expressions and Messages
  18. [Live Exercise] Coding a Counter (check the subtitles here)

You can access

  1. the Week session slides
  2. the Pharo Mooc videos. Pay attention they may be not in the same order - Check the Resources slide in the lectures to get the corresponding Pharo Mooc session.

Week 2: Pharo Syntax and Inspector

  1. [Lecture] W2S01-Messages
  2. [Lecture] W2S02-Messages-ForTheJavaProgrammers
  3. [Lecture] W2S03-Basic-Variables
  4. [Lecture] W2S03-Messages-Precedence
  5. [Lecture] W2S04-Messages-Sequence
  6. [Lecture] W2S05-ParenthesisVsSquareBrackets
  7. [Lecture] W2S06-Yourself
  8. [Lecture] W2S07-CharacterStringSymbol
  9. [Lecture] W2S08-Basic-ArraySetOrderedCollection
  10. [Lecture] W2S09-UnderstandingMistakes
  11. [Lecture] W2S10-Iterators
  12. [Lecture] W2S11-Streams
  13. [Lecture] W2S12-RuntimeArchitecture
  14. [Live Exercise] GTInspector 1: Inspect and Interact with Objects (check the subtitles here)
  15. [Live Exercise] Spotter 1: Find and Browse a Class (check the subtitles here)
  16. [Challenge] Challenge 0

You can access

  1. the Week session slides
  2. the Pharo Mooc videos. Pay attention they may be not in the same order - Check the Resources slide in the lectures to get the corresponding Pharo Mooc session.

Week 3: Objects, Classes, Methods

  1. [Lecture] W3S00-TeapotAsAPretext
  2. [Lecture] W3S01-WhatisAnObject
  3. [Lecture] W3S02-WhatisAClass
  4. [Lecture] W3S03-MethodVsMessages
  5. [Lecture] W3S04-OOParadigm
  6. [Lecture] W3S05-SUnit
  7. [Lecture] W3S06-Discovering
  8. [Lecture] W3S7-EssenceOfDispatchExo
  9. [Live Exercise] Nautilus: First Meet with the Code Browser (check the subtitles here)
  10. [Live Exercise] Nautilus: Packages, Tags and Groups (check the subtitles here)
  11. [Live Exercise] Nautilus: How to Become a Super Pharo Developer: Understanding Sender and Implementors (check the subtitles here)
  12. [Live Exercise] Finding Methods with Finder (check the subtitles here)
  13. [Live Exercise] Coding a Counter in the Debugger (check the subtitles here)
  14. [Exercise] Coding a DSL
  15. [Challenge] Challenge 1

You can access

  1. the Week session slides
  2. the Pharo Mooc videos. Pay attention they may be not in the same order - Check the Resources slide in the lectures to get the corresponding Pharo Mooc session.

Week 4: Essence Of OOP

  1. [Lecture] W4S01-EssenceOfDispatchNot
  2. [Lecture] W4S02-EssenceOfDispatch
  3. [Lecture] W4S03-BasicClassMethods
  4. [Lecture] W4S05-LearningFromMistake
  5. [Lecture] W4S06-WhyTesting
  6. [Lecture] W4S07-Debugging
  7. [Live Exercise] Nautilus: Navigating Fast Inside Classes (check the subtitles here)
  8. [Live Exercise] Spotter 2: Filter Results by Category (check the subtitles here)
  9. [Live Exercise] How to load code from repository (check the subtitles here)
  10. [Live Exercise] How to load projects (check the subtitles here)
  11. [Live Exercise] Nautilus: An overview of Refactorings (check the subtitles here)
  12. [Live Exercise] Nautilus: Using the Quality Assistant and Code Critic (check the subtitles here)
  13. [Challenge] Challenge 2

You can access

  1. the Week session slides
  2. the Pharo Mooc videos. Pay attention they may be not in the same order - Check the Resources slide in the lectures to get the corresponding Pharo Mooc session.

Week 5: Inheritance

  1. [Lecture] W5S01-InheritanceAndLookup-1-Inheritance
  2. [Lecture] W5S02-InheritanceAndLookup-2-Lookup
  3. [Lecture] W5S03-InheritanceAndLookup-3-Super-V2
  4. [Lecture] W5S04-Design-ImplementingIfTrue
  5. [Lecture] W5S05-MoreOnVariables
  6. [Lecture] W5S06-Design-InstanceInitialization
  7. [Live Exercise] Nautilus: Inheritance view (check the subtitles here)
  8. [Live Exercise] Spotter: Scoping and Reducing Search (check the subtitles here)
  9. [Live Exercise] Spotter: Search, Navigate and Preview Files (check the subtitles here)
  10. [Live Exercise] Learning the Debugger (check the subtitles here)
  11. [Live Exercise] How to find a bug? (check the subtitles here)
  12. [Live Exercise] GTInspector: Inspect Files and Directories (check the subtitles here)
  13. [Challenge] Challenge 3

You can access

  1. the Week session slides
  2. the Pharo Mooc videos. Pay attention they may be not in the same order - Check the Resources slide in the lectures to get the corresponding Pharo Mooc session.

Week 6: Plans For Reuse

  1. [Lecture] W6S02-SelfSendsDiceHandle
  2. [Lecture] W6S03-ClassMethodsAtWork
  3. [Lecture] W6S04-SelfSendsArePlanForReuse
  4. [Lecture] W6S05-HookAndTemplate
  5. [Lecture] W6S06-Design-UseVsInheritance
  6. [Live Exercise] Diffing and Merging in Pharo (check the subtitles here)
  7. [Live Exercise] GTInspector: Build Custom Tab Views for your Objects (check the subtitles here)
  8. [Challenge] Challenge 4

You can access

  1. the Week session slides
  2. the Pharo Mooc videos. Pay attention they may be not in the same order - Check the Resources slide in the lectures to get the corresponding Pharo Mooc session.

Week 7: Deeper into Lookup

  1. [Lecture] W7S02-InheritanceAndLookup-5-LookupMetaclasses
  2. [Lecture] W7S03-UnderstandingClassMethods
  3. [Lecture] W7S04-AdvancedPointOnClasses
  4. [Lecture] W7S05-Design-LearningFromRealExample
  5. [Lecture] W7S06-AvoidIsNill
  6. [Live Exercise] Spotter: The Preview pane (check the subtitles here)
  7. [Live Exercise] Spotter: Search in Playground History (check the subtitles here)
  8. [Live Exercise] GTInspector 3: Understand Pharo Internals by Inspection (check the subtitles here)
  9. [Challenge] Challenge 5

You can access

  1. the Week session slides
  2. the Pharo Mooc videos. Pay attention they may be not in the same order - Check the Resources slide in the lectures to get the corresponding Pharo Mooc session.

Week 8: More on Dispatch

  1. [Lecture] W8S01-Design-DoubleDispatch-Dice
  2. [Lecture] W8S02-Design-DoubleDispatch
  3. [Lecture] W8S03-Design-DualInterfaces
  4. [Lecture] W8S05-OtherLanguages

You can access

  1. the Week session slides
  2. the Pharo Mooc videos. Pay attention they may be not in the same order - Check the Resources slide in the lectures to get the corresponding Pharo Mooc session.

Mini projects

You will have mini projects (called semester projects) by team of 2 to 4 students.

Download Pharo

We will use Pharo 50 as the Pharo Mooc. Now you are free to use Pharo 6.1

About

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 influencedJavaScript, 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.