Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity names vs table names

We are going to develop a new system over a legacy database(using .NET C#).There are approximately 500 tables. We have choosen to use an ORM tool for our data access layer. The problem is with namig convention for the entities.

The tables in the database have names like TB_CUST - table with customer data, or TP_COMP_CARS - company cars. The first letter of prefix defines the modul and the second letter defines its relations to other tables.

I would like to name the entities more meaningful. Like TB_CUST just Customer or CustomerEntity. Of course there would be a comment pointing to its table name.

But the DBA and programer in one person, dont want names like this. He wants to have the entities names exactly the same to the table names. He is saying that he would have to remember two names and it would be difficult and messy. I have to say his not really familiar with the principles of OOP.

But in case of an entity name like TP_COMP_CARS there should be methods names like Get TP_COMP_CARS or SaveTP_COMP_CARS..I think this is unreadable and ugly.

So please tell me your opinion. Who is right and why.

Thank you in advance

like image 730
user137348 Avatar asked Dec 04 '09 09:12

user137348


1 Answers

The whole idea of ORM tools, is to avoid the need of remembering database objects. We usually create a database class with all the table and column names, so no one needs to remember anything, and the ORM should map database "names" to normal entities.

Although it is subjective, in my opinion you are right and he is wrong....

like image 60
Dani Avatar answered Oct 01 '22 20:10

Dani