This document discusses refactoring code in the DirectionService class that calculates estimated time of arrival and directions between points to use the state pattern. The current implementation has problems that need to be identified. Refactoring to use the state pattern will provide benefits over the original implementation.
This document discusses refactoring code in the DirectionService class that calculates estimated time of arrival and directions between points to use the state pattern. The current implementation has problems that need to be identified. Refactoring to use the state pattern will provide benefits over the original implementation.
This document discusses refactoring code in the DirectionService class that calculates estimated time of arrival and directions between points to use the state pattern. The current implementation has problems that need to be identified. Refactoring to use the state pattern will provide benefits over the original implementation.
In the Exercises project, look at the code in the state/
DirectionService class. This is the class that powers our mapping app. It provides two methods for calculating the estimated time of arrival (ETA) and the direction between two points.
Identify the problems in this implementation. Then, refactor the code
to use the state pattern. What are the benefits of the new implementation?