ORM, Object-Relational Mapping, Shoplazza geekZone

ORMs are popular and controversial at the same time. Advocates of ORMs claim they increase productivity, improve application design, reuse code and maintain the application over time. According to detractors, a negative aspect of ORMs is performance. This article will provide an overview of ORMs, compare them against SQL tools, and review the pros and cons of these tools so that you can decide if ORMs will help or hurt your database application development efforts.

The challenge OOP developers have is the need to understand and code in the structured query language (SQL) in order to connect their application to an SQL database. Developers who know SQL can write data-access code. This raw SQL coding can be extremely time-consuming because it requires the developer to extract the code strings’ data elements. SQL query builders add a layer of abstraction to the SQL code to provide more information about the data. However, developers still need to understand and write SQL.

What is an ORM?

An object-relational mapper provides an object-oriented layer between relational databases and object-oriented programming languages without having to write SQL queries. It standardizes interfaces reducing boilerplate and speeding development time.

Object-oriented programming includes many states and codes in a format that is complex to understand and interpret. ORMs translate this data and create a structured map to help developers understand the underlying database structure. The mapping explains how objects are related to different tables. ORMs use this information to convert data between tables and generate the SQL code for a relational database to insert, update, create and delete data in response to changes the application makes to the data object. Once written, the ORM mapping will manage the application’s data needs and you will not need to write any more low-level code.

How does ORM work?

ORMs create a model of the object-oriented program with a high-level of abstraction. In other words, it makes a level of logic without the underlying details of the code. Mapping describes the relationship between an object and the data without knowing how the data is structured. The model can then be used to connect the application with the SQL code needed to manage data activities. This “plumbing” type of code does not have to be rewritten, saving the developer a tremendous amount of time.

What are the best Object Relational Mapper (ORM) Tools?

Hibernate, Sequelize, SQLAlchemy, Entity Framework, and Doctrine 2 are the most popular tools in the category “Object Relational Mapper (ORM)”. “Easy ORM” is the primary reason developers pick Hibernate over its competitors, while “Good ORM for node.js” is the reason why Sequelize was chosen.

What is ORM example?

An ORM library is a completely ordinary library written in your language of choice that encapsulates the code needed to manipulate the data, so you don’t use SQL anymore; you interact directly with an object in the same language you’re using. With an ORM library, it would look like this: book_list = BookTable.

Read more from Shoplazza geekZone on Medium, click here.

Read more from Shoplazza blog, click here.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Luc chan

Luc chan

Database engineer going rogue on cloud architect