Skip to content

Schottlw code review 2#16

Open
schottlw wants to merge 7 commits intoColinMaxwellSprint3Branch_4from
schottlw_code_review_2
Open

Schottlw code review 2#16
schottlw wants to merge 7 commits intoColinMaxwellSprint3Branch_4from
schottlw_code_review_2

Conversation

@schottlw
Copy link
Copy Markdown
Collaborator

@schottlw schottlw commented Apr 5, 2022

Analysis of the program
(Note: My code review is based on the branch with most and recent commits, ColinMaxwellSprint3Branch_4)

Overall, there’s some good progress being made on this app!

  • The code is readable and understandable for the most part, there are a few misspellings and things with over-general names that carried over from the last review (See schottlw code review 1 for detail)
  • A new DTO was added and there were updates to existing files, signaling forward progress
  • A new class ‘SearchActivity’ was added with reference to ‘searchable.xml’, though I’m not sure of it’s current purpose

Was the program available in UC Github on time?

Yes

Is the program documented/commented well enough for you to understand?

  • Most code is self explanatory and readable with some comments for extra explanation
  • Not sure what the purpose of the SearchActivity class is at this time


Does the program compile?
There was some red lined code upon opening the project, but this isn’t the main branch so it’s most likely a work in progress

Rationale behind my changes

  • Renamed variables according to Kotlin naming conventions
  • Removed redundant code
  • Used IDE recommended formatting for better readability and less code
  • Declared ‘Specimen’ class as a data class to tell compiler class is for holding data

All of these changes aim to reduce technical debt of the in-progress project and allow it to be more readable as well as allow more functionalities to work

Three technical concepts I learned

Three of my commits

var movieCountry : String = "",
var movieBoxOfficeGross: String = "",
var movieOpeningWeekendGross : String = "",
var movieDistributor : String = "") {
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.

Made first letter of variable names lowercase based on Kotlin naming conventions (https://kotlinlang.org/docs/coding-conventions.html#naming-rules)

override fun toString(): String {
return "$movieTitle"
return movieTitle
}
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.

Removed redundant string formatting

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LOL... yes.

btn_FindMyMovie.setOnClickListener {
val btnFindMyMovie = findViewById(R.id.btn_FindMyMovie) as Button
btnFindMyMovie.setOnClickListener {
// your code to perform when the user clicks on the button
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.

Removed underscore from variable name based on Kotlin naming conventions (https://kotlinlang.org/docs/coding-conventions.html#naming-rules)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I don't see this change...
We use underscores for constants. Otherwise, correct, we typically don't use them in variable names.


val btnFindMyMovie = findViewById(R.id.btn_FindMyMovie) as Button
val btnFindMyMovie = findViewById<Button>(R.id.btn_FindMyMovie)
btnFindMyMovie.setOnClickListener {
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.

Android Studio recommended formatting

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.


class Specimen(var movieTitle: String = "",
data class Specimen(var movieTitle: String = "",
var movieRank: Int = 0,
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.

Declared 'Specimen' as a data class to tell compiler class is for holding data

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 again.

import com.google.gson.reflect.TypeToken

public data class Movie(@SerializedName("rank")var rank: Int, @SerializedName("title")var title: String,
data class Movie(@SerializedName("rank")var rank: Int, @SerializedName("title")var title: String,
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.

Removed redundant visibility modifier

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

Choose a reason for hiding this comment

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

Good catch!

@discospiff
Copy link
Copy Markdown

Several good suggestions here, which reduce technical debt. I recommend merging this branch.

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