Object Oriented Programming
Last reviewed 22 Feb 2020 by Crispin Read
Description
An introduction into object oriented programming design patterns.
Why this is important
Using design patterns can save time as well as help developers to create software that is easier to maintain by promoting code re-use ( Inheritance, Polymorphism, Encapsulation )
Outcomes
At the end of this training you will be able to:
- Create code using inheritance
- Navigate code to find methods being called.
- Decide when oop is appropriate and when it is not.
Learner Requirements
- A computer with a fresh PHP development environment.
Outline
- What is OOP
- The three principles of OOP.
- Encapsulation
- Inheritance
- Polymorphism
- Loose coupling and high cohesion
- OOP Design patterns in PHP
- Factory
- Singleton (The anti pattern)
- Strategy
- OOP examples in Drupal
- Alternatives to OOP in PHP ( OOP is not a golden bullet )
Tasks
During Training
- Create a class and subclass that represents person and employee.
- Create a module that benefits from using OOP
After Training
- Navigate the code inside of the Drupal core and see if you can understand what code is being executed.
- Fork the repo in the resources below and read through the examples.
Extra
Resources / Reference
Skills, Knowledge, Behaviours and Values
Core Skills
This workshop is designed to develop the following from our core skills directive
- Estimation
- Communication
- Teamwork
Apprenticeship Standard
This workshop will encourage the development of the following from the Software Developer Level 4 Standard
COMPETENCIES (Skills)
- C1 - Logic: writes good quality code (logic) with sound syntax in at least one language.
- C10 - Can apply good practice approaches according to the relevant paradigm (for example object oriented, event driven or procedural).
- C11 - Can interpret and follow:
- software designs and functional/technical specifications
- company defined ‘coding standards’ or industry good practice for coding
- testing frameworks and methodologies
- company, team or client approaches to continuous integration, version and source control
- C14 - Can apply the maths required to be a software developer (e.g. algorithms, logic and data structures).
BEHAVIOURS
- B1 - Logical and creative thinking skills.
- B2 - Analytical and problem-solving skills.
Knowledge
- K3 - Understands how teams work effectively to produce software and contributes appropriately.
- K4 - Understands and applies software design approaches and patterns and can interpret and implement a given design, compliant with security and maintainability requirements.