Conversation
This reverts commit f673eae.
| interface MedicineDAO { | ||
| @Query("SELECT * FROM Medicine ORDER BY name ASC") | ||
| fun getAlphabetizedMedicine(): Flow<List<Medicine>> | ||
| fun getAllAlphabetizedMedicine(): Flow<List<Medicine>> |
There was a problem hiding this comment.
Just added All to the name of the function, as the query is fetching all rows from the Medicine DB
| kapt "androidx.room:room-compiler:2.5.0" | ||
| implementation "androidx.room:room-ktx:2.5.0" | ||
| def room_version = "2.5.0" | ||
| implementation "androidx.room:room-runtime:$room_version" |
There was a problem hiding this comment.
Added version variable to make it a little easier to update any room dependencies.
There was a problem hiding this comment.
Good idea. Dependencies are like whack a mole in Android.
| @ColumnInfo(name = "prescription length") val lengthInDays: Int | ||
| @NonNull @ColumnInfo(name = "start date") val startDate: String, | ||
| @NonNull @ColumnInfo(name = "prescription length") val lengthInDays: Int | ||
| //,@ColumnInfo() val endDate: Date = startDate |
There was a problem hiding this comment.
Added non nulls, as the name of the medication, start date, and start day should be required values.
| /** | ||
| * Declares the DAO as private property in the constructor. | ||
| * Pass in the DAO instead of the whole database, because you only need access to the DAO | ||
| */ |
There was a problem hiding this comment.
Added kdoc above the class
| abstract fun medicineDao(): MedicineDAO | ||
|
|
||
| //Singleton prevents multiple instances of database opening at the same time. | ||
| companion object { |
There was a problem hiding this comment.
Moved comment out of the actual code block and added a blank kdoc section for future documentation. Since it is a public class, there should be some documentation for it.
https://kotlinlang.org/docs/coding-conventions.html#coding-conventions-for-libraries
| /** | ||
| * | ||
| */ |
|
A few things I'd harvest from this review. I am cautious about empty KDoc. That is not adding any value, and is just clutter. |
Analysis of the program.
This application is to help with keeping track of what kind of medication is taken and when to take it. It will also integrate with Android in the future to set up reminders.
Data will be stored and organized using Room, a local database. The database will be called Medicine. The Medicine DTO will define the medicine table. The Medicine DAO will define how data will be read, updated, and deleted. The MedicineRoomDatabase will bootstrap the Room database and connect the DAO and DTO. The last class, MedicineRepository, I am not sure about. One take away from it, it uses a coroutine to execute any actions against the database on a non-UI thread.
Was the program available in UC Github on time?
Is the program documented/commented well enough for you to understand?
Does the program compile?
Rationale behind your changes.
Links to three specific commits that you made to your own group's GitHub repository before the end of sprint deadline.
Next, list three specific technical concepts that you learned from this code review. Copy and paste samples to demonstrate your point.
Room - I watched Module 13 videos on Room, so I learned how room is boot strapped, how DTOs are used as Room data entities/table definitions, and how DAOs are used to run any CRUD operations against the database.
Room/Flow - Flow seems to be comparable to observables. If any changes are made against the database, flow will see them happen and be used to help make live updates to the UI.
@Suppress("RedundantSuspendModifier")/@workerthread - This was implemented in the application to help move any database queries or operations off of the UI thread. Seems similar to coroutines.