Domain-Specific Models
[]
Dan Lew Codes
For a long time at Trello Android, we used the same class for parsing API calls (via Gson), making DB transactions (via OrmLite), and displaying data in the UI. A piece of the UI might query the DB for a Board , use it once, then later use that exact same Board instance again only to find that the Board ’s data changed in secret. Also, it solves all of the problems outlined above: all data is available in each model, immutability can be achieved where it really counts, we can make more non-null guarantees, there’s only one name per property per model, and the UiModels can be limited to only the data needed and nothing more.