While working on the Azure Cosmos DB JavaScript SDK, I decided to refactor the continuation token management system to use inheritance for better code organization. Previously, we had separate, independent classes handling different query types, which led to code duplication and maintenance overhead.
The refactoring goal was to:
- Extract common continuation token logic into a
BaseContinuationTokenManager
- Create specialized subclasses like
OrderByQueryContinuationTokenManager
andParallelQueryContinuationTokenManager
- Eliminate code duplication across query types
- Make the system more maintainable and extensible