Sunday, December 20, 2015

Defining your application model



When you start a project, one of the first task to do is to design the application model. Some people associate this task with the design of the relational database model. When you have the model designed, you have the 80% of the application done. In fact, if you are working with a Oriented Object language, you should design your model in terms of objects first.  Relational databases are one option to implement the persistency requirement, but as you know is not the only way. Hence, if you are thinking your model in terms of tables and so on, you are coupling your business with a concrete technology. Then if you choose a OO language like Java, you have to design the model in terms of objects. In fact , for this reason exist tools like ORMs (hibernate, Ibatis,...) or APIs like JPA, to decouple your model from the persistence technology chosen.

I think that they are some key questions to help you to do a good choice:

  • Do you need ACID transactions ? Is it critical for your business the inconsistency (for example ghost reads) ? If not NoSQL could be a good option.
  • Do you need storage procedures or triggers at the persistency tool level? If you can manage this from your code, NoSQL could be a good option.
  • Do you need a rigid scheme? If not NoSQL could be a good option.
  • Is the consistency critical? If not NoSQL could be a good option.
  • Do you need to support a very large data loads? NoSQL can scale better than RDBMS. Normally RDBMS scales with more hardware. 
  • Do you need to support a lot of concurrent users? NoSQL again.
  • Do you need a very consistent performance ? NoSQL again.
Think in your requirements, imagine you are a driver. If you want to win a race, your skills are important, but also your car. You need a competitive car. You don't need a comfortable car, with radio, alarm , leather seats, or whatever else. What you need is a faster car, with good brakes and powerful engine, nothing more. Something similar happens with a RDBMS and  a NoSQL system. 

What kind of car do you need for your trip?

Until next post.

No comments:

Post a Comment