Reviewing and testing our refactored code
With these changes made, let’s take a step back and look at the result.
We took a flight search system and used object-oriented programming techniques to improve its flexibility and maintainability by doing the following:
- Reorganizing the code into appropriate files and namespaces
- Introducing a base class and improving code reuse in flight information
- Controlling a large number of parameters by moving them into a new class
- Introducing another new class to manage common information about airport events including both an airport and a time component
- Adding a charter flight class with a flexible cargo tracking system
- Introducing a polymorphic way of searching flights that will be more flexible and maintainable over time
Refactored code
The final refactored code from this chapter is available in the https://github.com/PacktPublishing/Refactoring-with-CSharp repository inside of the Chapter05/Ch5RefactoredCode...