Back to articles
Navigation/Route Calculation System
How-To

Navigation/Route Calculation System

via Dev.to BeginnersNOOB

Navigation Route Calculation System - Strategy Pattern This is an implementation of the Strategy design pattern for a navigation system like Google Maps. Problem Statement Building a backend for a mapping application where the route calculation algorithm changes based on transport mode. The system must be extensible without rewriting the core engine. Class Diagram +-------------------------------------+ +----------------------------------+ | Context | | Interface | |-------------------------------------| |----------------------------------| | NavigationService | | RouteStrategy | |-------------------------------------| HAS-A |----------------------------------| | - strategy: RouteStrategy |<>---------->| + calculateRoute(src, dest) | | + setStrategy(RouteStrategy) | +----------------------------------+ | + buildRoute(src, dest) | ^ +-------------------------------------+ | | IMPLEMENTS +-----------------------------+-----------------+------------------------------+ | | | +-------------

Continue reading on Dev.to Beginners

Opens in a new tab

Read Full Article
3 views

Related Articles