locationtech / locationtech/spatial4j

DistanceUtils is hell

Open
#22 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

API
Dominant language
Java
Stars
961
Forks
172
PR merge metrics
No merged PRs in 30d

Description

It's a mix of badly formatted code, bad variable names, too many comments to be readable, calcBoxByDistFromPt_latHorizAxisDEG, Shapes are used but never Points (always lat, lon as separate doubles), some major methods aren't even used and it's impossible to tell what's been tested by TestDistances (which seems to double as both a test for DistanceUtils and for DistanceCalculators).

Ideally most of the distance methods would be moved to their Calculators. Any distance calculations directly used by multiple consumers should be re-evaluated to see if the consumers should be using Calculators instead.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading DistanceUtils and TestDistances, then compare their coverage with the DistanceCalculators. Review the uses of calcBoxByDistFromPt_latHorizAxisDEG and the distance methods to identify unused code and shared consumers. Done means the responsibilities and tests are clearly separated, with distance logic placed appropriately.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.