Skip to content

Robin3a5 code review1#7

Open
robin3a5 wants to merge 4 commits intoProfile_Pagefrom
robin3a5_codeReview1
Open

Robin3a5 code review1#7
robin3a5 wants to merge 4 commits intoProfile_Pagefrom
robin3a5_codeReview1

Conversation

@robin3a5
Copy link
Copy Markdown
Collaborator

@robin3a5 robin3a5 commented Mar 4, 2023

Analysis of the program: I only examined the profile page part of the program, but it looks great. I like the use of the loading bar to display progress on goals and the expand and collapse of workouts is very nice.

Was the program available in UC Github on time? Yes

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

Does the program compile? Yes

Rationale behind your changes:
For internationalization any string constants in the app should be placed in strings.xml - https://developer.android.com/jetpack/compose/text

Its best to put computations outside of composable functions since they could recompose often hurting performance -https://developer.android.com/jetpack/compose/performance/bestpractices

Best not to have some "Magic numbers" in your code especially those that are used repeatedly -
Don't have an exact resource on it, just known as a best practice - https://en.wikipedia.org/wiki/Magic_number_(programming)

Links to three specific commits that you made to your own group's GitHub repository before the end of sprint deadline:
https://github.com/steelesh/IdeaStorm/commit/6b05db39cfc05e081c726bb7f9d3254c600ace7d
https://github.com/steelesh/IdeaStorm/commit/98ba5fff37076a2e04f08c8f5c6bfdb64290c50c
https://github.com/steelesh/IdeaStorm/commit/c192d7a5585b1e139cd5dc3fe917e05fa4353f9d

Specific Technical Concepts:
How to use stringResource to place strings from strings.xml into composable functions
How to avoid expensive computations in composable functions
How to add padding to columns for proper alignment of elements

) {
Column {
Text(text = "Height", fontWeight = FontWeight.Bold)
Text(text = stringResource(R.string.height), fontWeight = FontWeight.Bold)
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.

Using strings.xml is best practice and gets app ready for internationalization- https://developer.android.com/jetpack/compose/text

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.

)
)
val goals = listOf(
var goals = listOf(
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.

Ignore this, read the doc wrong

goals = goals,
workouts = workouts
)
for (workout in workouts) {
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.

Pulling this out of your compose functions improves performance since this will never have to be recomposed - https://developer.android.com/jetpack/compose/performance/bestpractices

@robin3a5 robin3a5 changed the base branch from main to Profile_Page March 4, 2023 20:53
import androidx.compose.ui.unit.dp
import com.example.workoutapp.ui.theme.WorkoutAppTheme

const val PADDING_16 = 16
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.

Added some constants of reused numbers to avoid some magic numbers in code - https://en.wikipedia.org/wiki/Magic_number_(programming)

@discospiff
Copy link
Copy Markdown

Several good concepts to harvest.

  • Externalize to strings.xml
  • Use of constants

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