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.
- 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)
- Slides
- Laptops
- Internet access
- Post-its
- Markers
- A3 paper for apprentices to draw on
- Whiteboard (or flipcharts if this is not possible)
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.
- 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! :)
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)
- Supermarket Kata
- The Secret behind the Single Responsibility Principle on Hacker Noon
- Clean Code by Robert C Martin
- Duplicate Code ‘Code Smell’
The slides can be viewed from the link at the top of the repository.
- 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)
- Programming paradigms
- Why OO?
- How to think about objects
- Why source control
- Create, clone, commit, push
- 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
- Encapsulation
- Cohesion
- Functional Decomposition
- Critiquing and adapting poorly implemented checkout kata
If you’d like to contribute changes to the slides or exercises, please see our contributing guidance.