Skip to content

Code quality feedback #2

@katerina520

Description

@katerina520
  • These methods are pretty identical, can move to a helper function that takes the URI as a param

    public void publishTweet(String tweetContent, JsonHttpResponseHandler handler) {
    String apiUrl = getApiUrl("statuses/update.json");
    // Can specify query string params directly or through RequestParams.
    RequestParams params = new RequestParams();
    params.put("status", tweetContent);
    client.post(apiUrl, params, "", handler);
    }
    public void favoriteTweet(String tweetId, JsonHttpResponseHandler handler) {
    String apiUrl = getApiUrl("favorites/create.json");
    // Can specify query string params directly or through RequestParams.
    RequestParams params = new RequestParams();
    params.put("id", tweetId);
    client.post(apiUrl, params, "", handler);
    }
    public void unfavoriteTweet(String tweetId, JsonHttpResponseHandler handler) {
    String apiUrl = getApiUrl("favorites/destroy.json");
    // Can specify query string params directly or through RequestParams.
    RequestParams params = new RequestParams();
    params.put("id", tweetId);
    client.post(apiUrl, params, "", handler);
    }
    public void retweetTweet(String tweetId, JsonHttpResponseHandler handler) {
    String apiUrl = getApiUrl("statuses/retweet/" + tweetId + ".json");
    // Can specify query string params directly or through RequestParams.
    RequestParams params = new RequestParams();
    params.put("id", tweetId);
    client.post(apiUrl, params, "", handler);
    }
    public void unretweetTweet(String tweetId, JsonHttpResponseHandler handler) {
    String apiUrl = getApiUrl("statuses/unretweet/" + tweetId + ".json");
    // Can specify query string params directly or through RequestParams.
    RequestParams params = new RequestParams();
    params.put("id", tweetId);
    client.post(apiUrl, params, "", handler);
    }

  • It's great to have a lot of comments for ambiguous parts of code. For clear descriptive lines, feel free to remove comment:

    // if not favorited
    if (!tweet.isFavorited) {

  • Feel free to remove debugging logs. Or if it's important signal log, maybe remove "hopefully" =) . I explained about logs this week after you already committed this code, so no worries.

    Log.i("adapter", "Tweet favorited hopefully");

  • Great job providing descriptive commit names! Instead of listing "Finished required features and the following stretch features:... ", better to just name the feature you are adding, for readability.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions