Is it a good idea to use ORM for Android apps?
Is it good to use ORM (Object Relational Mapper) like:
- ORMLite
- ActiveAndroid
for Android apps.
The abstraction layer this method adds has the calculation itself and the memory overhead. Since these resources and battery life are mostly very limited, I would think no, but on the other hand, it makes the code much cleaner because you almost never have to write raw queries.
- What are the pros and cons?
- What is recommended?
- If recommended, which one should I use?
source to share
OrmLite uses the SQLite database at the bottom. It just generates the database schema using the annotation processor. This is a good idea if your project allows open source third party libraries. However, you must encapsulate all implementation-dependent functions - the "Tao" pattern. By doing so, you can switch between database implementations. However, be careful with Realm. It is a very powerful database, but if you use it incorrectly, it can mess up your architecture. Always specify the Dao interface before implementing the database itself.
source to share