Jasmin Fajkic
02/02/2023, 1:55 PMColton Idle
02/03/2023, 5:29 AMPaul Woitaschek
02/04/2023, 4:46 PM.kt
extension. Then we’ll have proper syntax highlighting.
There is way too much stuff going on to give a proper code review in a short amount of time so I have fed it to chatGPT:
1. Use null
checks and default values for the saved state handle instead of using the Elvis operator in the survey
property.
2. Use a separate function for the parsedSurvey
object to avoid repeating the same code.
3. Simplify the repeated code in question answer functions by creating a separate function that takes the question id and answer data as parameters.
4. Extract the state update code into a separate function to avoid duplicating code and make the code more readable.
5. Consider renaming functions to follow the Kotlin naming conventions and to better describe the actions being performed.
It then gives an example that restructures your code but these 5 points should give you already a proper head start