Skip to content

Database development

rbonifacio edited this page Aug 30, 2012 · 6 revisions

Android database development is quite easy, and we learn how to do that implementing some functionalities related to the PlayList feature. There is a kind of pattern, well documented in the literature, which basically comprises:

  • a database helper class, which implements methods for creating and updating the database scheme;
  • a manager class that implements queries and data manipulation tasks such as inserts, updates, and deletes;
  • pojos (plain old Java objects) representing the domain classes (in this case, PlayList and Media); and
  • an interface declaring some constants that are useful for avoiding "magic strings" in the source code.

The manager class could have been refactored, and part of its responsibilities extracted to a Data Access Object. But, given the the small complexity of the persistence layer, I am convinced that this wont be a good decision, and such a refactory probably will only make the design more complicated.

In this case, we are following the simplicity value of XP.

XP Values

Clone this wiki locally