ahmedmutahar / android-protips-location

Automatically exported from code.google.com/p/android-protips-location
0 stars 0 forks source link

Some DRY issues in subclasses of ILastLocationFinder #1

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
1. The subtle differences in (the upper half of) getLastBestLocation() between 
GingerbreadLastLocationFinder and LegacyLastLocationFinder doesn't make sense 
to me. The code in GingerbreadLastLocationFinder looks correct.

2. The constructor GingerbreadLastLocationFinder() sets accuracy to 
ACCURACY_LOW but the comment above is about ACCURACY_COARSE (which is used in 
LegacyLastLocationFinder).

I suggest one of the following refactorings:
- Rename ILastLocationFinder to LastLocationFinder and turn it into an abstract 
class with common code, or
- Remove ILastLocationFinder, rename LegacyLastLocationFinder to 
LastLocationFinder, put the common code there and make 
GingerbreadLastLocationFinder extend that class.

While you're at it, you may also remove the redundant parenthesis in:
        if ((time > minTime && accuracy < bestAccuracy)) {

Oh, and thanks for an awesome deep dive! Helped me a lot.

Original issue reported on code.google.com by any...@gmail.com on 26 Jun 2011 at 9:44