How to structure CRUD code using OOP and not the old way?

Hi, I am beginner and trying to learn OOP code that not looks like spaghetti code.I would like to ask on how can I structure my code using OOP if I will do some CRUD operations. I want to create simple system that has login and can add users and contacts. I hope someone can link me to a good article or tutorial that helps me to learn this OOP crud not the old way of coding CRUD.

Thank you.

1 Like

that looks like you want to create an ORM (object-relational mapper), which is not a trivial thing to do. better focus on getting the classes right than forcing CRUD into OOP. there is nothing wrong with using SQL statements inside a class.

1 Like

you mean to create class that holds the CRUD operations ?

These two links can help get you started:

Don’t be alarmed by the references to the Symfony framework. The articles themselves are very generic. Though of course learning from an established oop framework which has support for various crud generators is not necessarily a bad thing.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.