This is a list of resources for a 2-day C++ class covering a rage of topics including:
- Test Drive Development
- Refactoring (Martin - Refactoring)
- rename method
- rename class
- extract method
- extract class
- replace switch/conditional logic with polymorphism
- encapsulate typecode
- Legacy Refactoring (Feathers - Working Effectively with Legacy Code)
- characterization tests
- extract class
- extract method
- Design Patterns
-
[[CppRpnCalculatorStrategyPatternExample strategy pattern]] -
[[CppRpnCalculatorTemplateMethodPatternExample template method pattern]] -
[[CppRpnCalculatorAbstractFactoryPatternExample abstract factory pattern]]
-
Projects
-
RPN Calculator: Here’s some source code for the [[RpnCalculatorCppExampleImplementation Rpn Calculator in C++]] (RPN –> Reverse Polish Notation –> post-fix, think HP calculators) - Refactoring (with tests in place): [[file:CalculateRates_clean_code.zip]]
- Refactoring (conditional logic to polymorphism): [[file:CalculateRates_conditional_to_polymorphism.zip]]
- [[ReplaceSwitchWithPolymorphismDetailedRefactoringInstructions]]
- Characterization Tests: [[file:CalculateRates_characterization.zip]]
- After polymorphism applied: [[file:CalculateRates_polymorphism_applied.zip]]
Working in Visual Studio with this Files
- Download zip file
- Download CppUTest
- Get it built in your version of visual studio
- Create a new project (win 32 console), e.g. RpnCalculator, CleanCode, ReplaceConditionalWithPolymorphism, Characterization, PolymorphismSolved
- Select solution and add existing project
- Find your CppUTest solution folder and add the project file
- Have your new project (RpnCalculator, CleanCode, etc.) depend on the CppUTest project
- Update your new project’s include directory to include the include directory of CppUTest
- Find the zip file, open it and extract all of the files into the source directory of your project
- Select your project and add existing, add all of the header and source files
Comments