jeudi 21 février 2019

is this way of call a function a bad practique?

I have the following code:

public void moveCameraTo(Location location){
        moveCameraTo(location.getLatitude(), location.getLongitude());
    }

    public void moveCameraTo(double latitude, double longitude){
        LatLng latLng = new LatLng(latitude, longitude);
        moveCameraTo(latLng);
    }

    public void moveCameraTo(LatLng latLng){
        GoogleMap googleMap =  getGoogleMap();
        cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, INITIAL_MAP_ZOOM_LEVEL);
        googleMap.moveCamera(cameraUpdate);
    }

I think that with this way I eliminate the responsibility to know what is a LatLng in another class for example.

What do you think?

Aucun commentaire:

Enregistrer un commentaire