Skip to content

re: Explain ORM like I'm five VIEW POST


Imagine you have a box that automatically order all your building blocks in whatever way you want to.
Your building blocks are data entries in the database.
The magic box is the ORM which allow you to make a better use of your building blocks.
Let's say you are creating a boat, so you need round pieces for the life boats. You ask to box for only round pieces.
In development this is called a query and a ORM help you to query in the DB
Let's assume you buy more building blocks. You put them in the magic box and everything is order.
An ORM will help you to add data to the database taking care of inner capabilities of the DB. By examples if the tables exist or not. If the magic box knows the type of building block or it is the first time it see it.
Now imagine you used to buy Legos, and found a compatible alternative brand, so you buy thoose and put them in your magic box.
An ORM also take cares of creating databases.
Now imagine your father or mother bought a bunch of building blocks as a surprise gift for your birthday, the box will take care of not letting you know those are there untill your parents decide to allow it. An ORM handle users and permissions in an easy way.


I love this building blocks analogy! I also agree that it seems like many of these folks haven't met a 5-year-old. Extending the blocks analogy...

Imagine that I ask you to make some sculptures of fishes for me. I don't really care what material you use to make the sculpture - you can use clay, or legos, or popsicle sticks. As long as it's a sculpture, and the things you give me look like fishes, I'm happy.

The fish is the object, the database is the material (clay/legos or maybe MySQL/PostgreSQL), and you, the sculptor, are the object-relational mapper. Maybe you started making fishes out of legos, but now you like making them out of clay, but I'm still happy because you keep giving me fishes.


Your fishes are a great way metaphore for models!


Thanks, I'm surprise this 5 year old frame, is not respected as the title indicates.
I have add another comparison, if remember anything else I'll keep them coming.

code of conduct - report abuse