Refactoring techniques in improving code quality and implementation of design patterns in C++
LICZBA DNI: 3 (24h)
KOD KURSU: CPP/REFACT
O szkoleniu
DLA KOGO?
Professional developers who want to learn about refactoring and implementation of design patterns in C++.
WYMAGANIA
Good knowledge of object-oriented programming with C++.
Cele szkolenia
Learn to assess code quality
Learn to point and name code smells and antipatterns as well as to discuss their negative impact on code quality
Understand and use various refactoring techniques
Understand the usage contexts of various design patterns along with their implementation
Program
Introduction
- Object-oriented paradigms
- What makes good software
- Design patterns and principles
- GRASP, SOLID and GoF
Code quality
- How to measure code quality?
- Code smells
- Duplicate Code, Long Parameter List, Long Methods, Large Classes, god class, Dependency on Implementation, Meaningless Names, Data Clumps, Primitive Obsession, Switch Statements, Lazy Class, Speculative Generality, and other code smells
- Antipatterns
- Cut-and-Paste Programming, Spaghetti Code, Programming to Implementation, Tight coupling, Golden Hammer, Poltergeist, Boat Anchor, Dead End, Ambigious Viewpoint, Lava Flow, Mushroom Management, and other antipatterns
- Improving code quality
- Refactoring process
- Unit tests for components under refactoring
- Clean code
- Encapsulation
- Composition over inheritance
- Programming to interfaces
- SOLID:
- Technology debt
Refactoring techniques
- Introduction
- Composing methods
- Introduce Explaining Variable
- Split Temporary Variable
- Replace Template with Query, Inline Temp, Inline Method i Extract Method
- Remove Assignments to Parameters
- Substitute Algorithm
- Simplifying method calls
- Replace Constructor with Factory Method, ErrorCode with Exception, Exception with Test, Parameter with Explicit Methods, Parameter with Method,
- Introduce Parameter Object
- Encapsulate Downcast
- Moving features between objects
- Move Method i Move Field
- Extract Class
- Inline Class
- Hide Delegate
- Remove Middle Man
- Introduce Foreign Method
- Introduce Local Extension
- Organizing data
- Replace Array with Object, Data Value with Object, Magic Number with Symbolic Constant, Record with Data Class, Subclass with Fields, Type Code with Class, Type Code with Strategy/State, Type Code with Subclasses
- Encapsulate Collection, Encapsulate Field
- Change Bidirectional Association to Unidirectional, Unidirectional Association to Bidirectional, Reference to Value, Value to Reference
- Simplifying conditional expressions
- Decompose Conditional Expressions, Consolidate Conditional Expressions i Consolidate Duplicate Conditional Expressions
- Remove Control Flag
- Replace Nested Conditional with Guard Clauses
- Replace Conditional with Polymorphism
- Null Object
- Generalizations
- Pull Up Constructor Body, Field, Method
- Push Down Field, Method
- Collapse Hierarchy
- Extract Interface, Subclass, Superclass
- Replace Delegation with Inheritance, Inheritance with Delegation
GoF design patterns
- When and how to use design patterns
- Creational design patterns
- Builder, Prototype, Factory Method, Abstract Factory, Singleton
- Structural design patterns
- Facade, Proxy, Composite, Adapter, Decorator, Bridge
- Behavioral design patterns
- Command, Observer, State, Strategy, Chain of Responsibility, Mediator, Visitor, Template Method
Summary
