Skip to content

Conversation

@thkruz
Copy link
Owner

@thkruz thkruz commented Nov 19, 2025

This refactor removes several anti-patterns and makes the class hierarchy more flexible:

  1. Removed manual type-checking methods: Replaced isSatellite(), isSensor(), isGroundObject(), and isMarker() methods with instanceof checks. This is more idiomatic TypeScript and reduces boilerplate code across the class hierarchy.

  2. Removed unused FOV2 system: The Sensor class had secondary field-of-view parameters (minRng2, maxRng2, etc.) that were validated but never used in any FOV calculations. This dead code has been removed from both the Sensor class and SensorParams interface.

  3. Made DetailedSatellite parameters optional: Changed constructor from requiring all four interfaces (DetailedSatelliteParams & LaunchDetails & OperationsDetails & SpaceCraftDetails) to making the detail interfaces optional using Partial<>. This removes the "all or nothing" pattern and allows child classes more flexibility.

  4. Updated tests: Modified BaseObject tests to use instanceof checks instead of the removed type-checking methods.

All existing tests pass (97 test suites, 26,185 tests).

This refactor removes several anti-patterns and makes the class hierarchy more flexible:

1. **Removed manual type-checking methods**: Replaced isSatellite(), isSensor(),
   isGroundObject(), and isMarker() methods with instanceof checks. This is more
   idiomatic TypeScript and reduces boilerplate code across the class hierarchy.

2. **Removed unused FOV2 system**: The Sensor class had secondary field-of-view
   parameters (minRng2, maxRng2, etc.) that were validated but never used in any
   FOV calculations. This dead code has been removed from both the Sensor class
   and SensorParams interface.

3. **Made DetailedSatellite parameters optional**: Changed constructor from requiring
   all four interfaces (DetailedSatelliteParams & LaunchDetails & OperationsDetails
   & SpaceCraftDetails) to making the detail interfaces optional using Partial<>.
   This removes the "all or nothing" pattern and allows child classes more flexibility.

4. **Updated tests**: Modified BaseObject tests to use instanceof checks instead of
   the removed type-checking methods.

All existing tests pass (97 test suites, 26,185 tests).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants