Skip to main content

Databases and ORMs

ORM or Object-relational mapping is a method to access and manipulate objects without having to consider how such objects relate to their data sources. With ORMs the code needed to manipulate our data is encapsulated and hidden in a way that we don't need to work with SQL directly; we just interact with the object in the same language we're using.

Image result for ORM

ORMs provide the user with many advantages such as: It saves a lot of time thanks to writing DRY code and MVC code and you're not supposed to write poor SQL statements. And it's more flexible. As for the weak points, they're not lightweight tools and we need to learn them. Also SQL does better in big projects than them.

Examples:
1- Javascript: Sequilize, Bookshelf.js and Mongoose
2- Java: Hibernate.
3- C#: Entity Framework

And to conclude this blog I'm going to say that we shouldn't always go for ORMs but instead try working with SQL implementations like MySQL and others. It all depends on the specific needs of the application underdevelopment.

Comments

Popular posts from this blog

Stack vs. Queue

Stack is like a pile of  books placed on top of each other. We can add new books to the top and can remove them from only the top because stacks are LIFO which means last-in, first-out. Queues on the other hand are the opposite, which is FIFO meaning first-in, first-out. So adding an element to the queue will be the same but removing will happen to the first element not the last one. An example of a queue would be the wait line in front of any kind of service we see around us like the bus station or the shops,....etc.

Middlewares

Middlewares in Javascript are functions that come in the middle of the request-response cycle. They have access to both the request and the response object as well as the next middleware function to be executed; usually called next(). Popular examples on middleware include: body-parser, cors, session, cookie-seesion and cookie-parser.