Skip to content
This repository has been archived by the owner on May 17, 2022. It is now read-only.

Latest commit

 

History

History

modules

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Modules

Introduction

As well as being a container for our code, modules can be used to package and deliver functionality to completely unrelated classes.

Modules written to be used in this way are called 'Mixins'.

Objectives

  • Write a a Mixin
  • Practice writing tests for Mixins

Exercise

In this folder you will find code for Person and Robot.

You'll note that they have similar capabilities, but they represent things that are fundamentally different. This means that inheritance may not be the right way to remove the duplication that exists between them.

Create sensible modules and the corresponding tests for them and the person and robot classes.

Extension

  • Find an efficient way to check that the module is in use
  • Both Person and Robot behave like walking talking things. Maybe shared examples could bring some benefit here?