Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Room DB abstraction layer to our app #1043

Open
maskaravivek opened this issue Jan 2, 2018 · 1 comment
Open

Introduce Room DB abstraction layer to our app #1043

maskaravivek opened this issue Jan 2, 2018 · 1 comment

Comments

@maskaravivek
Copy link
Member

For starters, heres an article explaining room
https://medium.com/google-developers/7-steps-to-room-27a5fe5f99b2

I recently used Room in one of the projects and found the following advantages.

  • making testing upgrade/functionality of db easier
  • cleaner code, removing boilerplate code
  • prepare for using livedata/flowables with RxJava
  • verifies queries at runtime

It would be great to have thoughts from others. @psh @misaochan

@psh
Copy link
Collaborator

psh commented Jan 3, 2018

The TL;DR - yes, I like Room but I think there are some fundamental things to address on the path toward using it.

Most of the advantages you cite can be derived from any modern ORM - I (and my team) evaluated

I really liked the generated code from GreenDAO - very efficient and by far the best performance - and the RxJava integration of sqlbrite got our attention too. I ended up recommending Room to our client based on a sense of longevity it brings and its small size - it adds very little to the app (method count or physical size) and smoothly integrates with our app's legacy Sqlite database installed on user's devices (precluding Object box and Realm from our team's evaluation)

Back to the Commons App again - we have a couple of PR - #1023 ("Extracted and tested the database interactions from Category") and #1022 ("Extracted and tested the database interactions from ModifierSequence") - that start us on the road toward using a tool like Room. Note: #1026 ("Extracted and tested the database interactions from Contribution") has already been merged.

Bugs like #894 ("Media details lost on device rotation") tell me that we need to address some core architecture. The contributions activity and the nearby activity both have complex models attempting to be shared across multiple fragments and activities. The ContributionsActivity relies on the somewhat arcane notification mechanism from Content Providers, Cursors and content URIs. There's complexity to address and bugs to fix.

Room is a very pretty band-aid being applied to a broken leg - definitely great at what it does, but only part of the overall picture.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants