Skip to content

My code review suggestions#13

Open
jdifrank wants to merge 1 commit intomasterfrom
difranjg_Code_Review_1
Open

My code review suggestions#13
jdifrank wants to merge 1 commit intomasterfrom
difranjg_Code_Review_1

Conversation

@jdifrank
Copy link
Copy Markdown
Collaborator

@jdifrank jdifrank commented Mar 10, 2022

Project Description:
Displays information about movie such as ranking and grossing based off of user search of movie name.
Project was available on time.
Not much commenting but classes were well organized and easy to follow.
Program compiled upon cloning.
Most changes were more 'best practice' suggestions.

JMaz-15/EasySurvey2@7ac28cb
JMaz-15/EasySurvey2@ce59acb
JMaz-15/EasySurvey2@589b0de

Comment thread app/build.gradle

implementation 'com.squareup.retrofit2:retrofit:2.8.2'
implementation 'com.sqeareup.retrofit2:converter-gson:2.7.1'
implementation 'com.squareup.retrofit2:converter-gson:2.7.1'
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed dependency typo.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

data class Movie(@SerializedName("rank")var rank: Int, @SerializedName("title")var title: String,
@SerializedName("country") var country: String, @SerializedName("boxOfficeGross")var boxOfficeGross: Double,
@SerializedName("openingWeekendGross")var openingWeekendGross: Double, @SerializedName("distributor")var distributor: String){
data class Movie(@SerializedName("Rank")var rank: Int, @SerializedName("Title")var title: String,
Copy link
Copy Markdown
Collaborator Author

@jdifrank jdifrank Mar 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SerializedName value should match JSON data feed
https://howtodoinjava.com/gson/gson-serializedname/

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Are these the names in the feed, with that capitalization?


override fun toString(): String {
return title
return "$title"
Copy link
Copy Markdown
Collaborator Author

@jdifrank jdifrank Mar 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kotlin shortcut in case you ever wanted to return more than just the movie title
https://kotlinlang.org/docs/java-to-kotlin-idioms-strings.html#take-a-substring

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an extra step, if it's not actually a string. I'd leave it as it were, until more string details are needed.

@jdifrank
Copy link
Copy Markdown
Collaborator Author

What I learned from code review:
how to implement in class lectures and assignments

@discospiff
Copy link
Copy Markdown

From this review, I'd fix the spelling error, and validate that the @SerializedName matches the JSON feed. Scrap it if it doesn't.

I wouldn't worry about the String shortcut, unless more is added to the String.

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.

2 participants