Jayakrishnan Salim
Jayakrishnan Salim

Reputation: 987

ORM lite for Android

I found out that ORM lite is a light weight ORM framework for SQlite and for Android.

The Question for me is:

Doesn't the inclusion of ORM make the application heavy?

I am thinking in the Java perspective and I know that using frameworks will make the application more heavy.

Can anyone help me resolving my doubt?

Upvotes: 0

Views: 285

Answers (2)

Gray
Gray

Reputation: 116918

@Stephen's answer is awesome but I thought I'd add my own. Full disclosure: I'm the author of ORMLite.

Doesn't the inclusion of ORM make the application heavy?

I think the answer depends highly on your application. It certainly makes the application more heavy. The question is if the cost/benefit makes sense for your situation. If the application is doing a lot of relational IO with a lot of entities then the benefit will be high. If the application is large then the additional bytes/classes may not add significantly to it. However if the increase in size is too much or the relational code is tiny then the benefit may be too little and not outweigh the size code.

Also, if the application is doing a ton of database IO and it may suffer from performance problems because of the increased GC bandwidth that can happen with ORM libraries. Then you may have to put up with doing your own hand SQL work.

Upvotes: 2

Stephen C
Stephen C

Reputation: 719576

Doesn't the inclusion of ORM make the application heavy?

This cannot be answered objectively.

Firstly, what do "light" and "heavy" mean?

Lets assume we are talking about some measure of the application:

  • we could be talking about the size of the application source code; i.e. the stuff that the programmer wrote
  • we could be talking about the size of the application binary ... including the libraries the application uses
  • we could be talking about the amount of memory used by the application, or the CPU time, or a measure of database traffic or disc traffic it generates.

But that just tells us what lighter and heavier mean. What about "light" and "heavy"? Is there an objective value for any of these measures where we can say "light" or "heavy"?

No ... there isn't.


But getting back to lighter / heavier. Can we say that using an ORM makes an application heavier?

On most measures, yes (probably), but in one important measure, the answer is clearly no. That is, when we use an ORM, we would expect that the programmer has less code (of various forms) to write than if the same functionality was implemented using JDBC, SQL & an RDBMs.


The other question that you didn't ask is whether it matters that an application is lighter or heavier. And I would say, that it really depends on the application, the platform and the development project's resources and timelines.

For instance, if I have a challenging set of requirements and a tight deadline, then I might use ORM irrespective of whether ORM uses more memory, CPU, database bandwidth, etc ... because it is lighter on the development side, and that means my project can be completed on time.


In summary:

  • Does ORM make an application heavy? This is not an meaningful question.
  • Does ORM make it heavier? It depends on what you are measuring.
  • Does it matter? Not if ORM heaviness is the trade-off for on-time and under-budget.
  • Is ORMLite really light-weight? Again not objectively answerable, and probably not relevant ... unless you are working within tight platform constraints.

Upvotes: 2

Related Questions