Skip to content

MCR-Digital/apprentice-boot-camp-fundamentals-1

Repository files navigation

Fundamentals One Boot Camp

This is the first of the boot camps, and we aim to introduce them to the concept of Object Orientated code and given time, the Single Responsibility Principal. While getting them set up with the exercises, we talk briefly about version control. They will work with an existing code base in the language they are focussing on. The code base models a deck of cards, with an interactive game of snap. They will attempt to improve the way the code is structured along the lines of the four OO principals, as we discuss them.

Although the primary focus is around OOP, we want to make sure they get plenty of experience writing code, as apprentices can sometimes find themselves not having written much by this point.

Competencies, Behaviours and Knowledge units

  • TC1 Logic: writes good quality code (logic) with sound syntax in at least one language
  • TC4 Test: can test code and analyse results to correct errors found using either V-model manual testing and/or using unit testing
  • TC10 Can apply good practice approaches according to the relevant paradigm (for example object oriented, event driven or procedural)

Resources Required

  • Slides
  • Laptops
  • Internet access
  • Post-its
  • Markers
  • A3 paper for apprentices to draw on
  • Whiteboard (or flipcharts if this is not possible)

Mentors / Languages

One mentor required per three apprentices (leads can act as mentors). These should be able to cover support for the required languages.

Several exercises (katas and code starters) will need to be ported to required languages if not already done.

Prep-work for apprentices

  • Make sure you can sign in to github.com with your own account
  • Fork this repo (so you can push your changes later)
  • Clone your fork: git clone https://github.com/[your-username]/apprentice-boot-camp-fundamentals-1.git
  • Follow the instructions in the README for your language under the exercises directory, making sure you can run the tests
  • It’s normal to have problems with this, so just let us know! :)

Follow-on tasks

Organisation mentors should look to exercise the knowledge we’ve covered in the boot camp. Below are suggestions for tasks that would do this, but please use your own judgement to work out what to do. There is no need for anything to be returned to MD or the presenters—it’s just a learning exercise.

  • Draw a diagram showing how the classes interact in some code you have been working on
  • They should identify Encapsulation, Abstraction, Inheritance, Polymorphism (this might require some discussion)
  • Take a look at one of your codebases and find examples of classes with multiple responsibilities
  • Try to improve some existing classes or methods with multiple responsibilities by using some of the OO principals
  • Finish off the exercises started at the boot camp (checkout kata for example)

Further reading / learning resources

Slides

The slides can be viewed from the link at the top of the repository.

Exercises

  • Identify objects from business scenario (groups)
  • Model a pack of playing cards (groups)
  • Use abstraction to make the Snap! game work for normal cards (groups)
  • Refactor the card model using inheritance (groups)
  • Use polymorphism to implement Super Snap! using a mixture of card types
  • Adapting Checkout Kata (pairs)
  • Separating responsibilities from Checkout Kata (pairs)

Boot Camp Summary

Object Orientation

  • Programming paradigms
  • Why OO?
  • How to think about objects

Source Control and GitHub

  • Why source control
  • Create, clone, commit, push

OO Principles

  • Modelling some classic scenarios with objects
  • Principles
    • Encapsulation
      • Apply to modelling
      • Rewrite some existing code to remove inappropriate intimacy and coupling
      • Code review some existing code
    • Abstraction
      • Apply to modelling
      • Rewrite some existing code to abstract complexity
      • Explain difference between encapsulation and abstraction
      • Introduce to interfaces
    • Polymorphism
      • Apply to modelling
      • Give some examples
    • Inheritance

Single Responsibility Principle

  • Cohesion
  • Functional Decomposition
  • Critiquing and adapting poorly implemented checkout kata

Contributing

If you’d like to contribute changes to the slides or exercises, please see our contributing guidance.