views:

338

answers:

12

I'm currently working on a site which went through god knows how many developers' hands. One of the things I don't like about it is the way every table in the database has the prefix "tbl_" and every field "fld_".

I've started work on a new feature and I'm faced with the following problem: should my new tables continue with the old convention, or not?

I guess I should, but I feel stupid doing it :)

+24  A: 

I would keep the same convention.. Regardless of if it's bad or not at least it would be consistent. And consistency will be very important to the next developer who gets ahold of the code.

Chris Lively
+1 for consistency
ChrisF
+1 When in Rome...
Andrew Hare
I was in the same boat, in that the application I was developing was mostly greenfield, but it was going to live in an existing database structure. I was using "good" clean standards, and when it came time for deployment I had to change everything to the "bad" way of naming database objects. Thank goodness for a DAL that's easily regenerated.
Agent_9191
+1  A: 

Go with which ever route costs less, in money and resources. If it's not going to save you money going through and re-tilling the ground, then don't. Just grit your teeth and move forward.

Jonathan Sampson
+2  A: 

If it a constant style throughout the application I would follow the naming convention it will make it much easier on the next developer.

Sean Barlow
+2  A: 

I tend to look at the scale involved. The consistency of a bad naming convention, to me, is preferable over a multitude of different ones in the same codebase or database.

If there are a handful of tables and you can safely change them, my feeling is to make the change. But anything of scale or an application that you're only doing a bugfix on is likely not worth the time and effort involved.

reallyJim
+1  A: 

"If it ain't broke, don't fix it"

0A0D
+1  A: 

I think you should prefer consistency and follow the convention already being used.

Think of the poor developer(s) who come along behind you and have to deal with two different naming conventions (the original one and your new one), neither of which the new developers like.

DOK
+6  A: 

Being a contractor, I am faced with this problem a lot. Here is my 2 cents:

If it isn't broken, then the client is wasting their money having me change that. Unless I am rewriting the entire app, I usually keep with the old (bad) standards (at least that way, you don't have part of the app with one convention and other parts using something different - this keeps the code readable by other developers).

Gabriel McAdams
+1  A: 

Welcome to the world of maintenance. ;)

Who's to say that the next person who works on the site won't despise the way you did things?

John at CashCommons
+2  A: 

You have two options.

  1. Change all the bad naming conventions to new ones.
  2. Use the old conventions.

Someone will be looking at this code later and will need to deal with any differences you create. That means you need to be aware that other people are affected by this decision. Do the right thing if you have time, do the ugly thing if you don't have the time... but keep it consistant.

+1  A: 

Any naming convention is better than no/inconsistent naming convention.

Victor Hurdugaci
A: 

I say change it iff there's a significant difference between the old code and the new code. For example, if the old way was a terribly dead-end and the new way is completely independent, then go ahead and start a new convention.

It's good to be visually consistent if the new material is structurally and semantically consistent, but if what you're doing is a clean break from what came before, then it's even more important that different things look different.

Ken
A: 

Like everyone said, stay with the bad convention since you are not writing it from scratch. However, use "good practice" if there is a compelling need for it (aka the end-user will be negatively affected otherwise). For example, if the "bad convention" makes the API users use boxing, change the value of strings and other performance-hit to a great degree; do not add to the problem! The end goal of software and API's is not to make the developers' life easier; but the end-user's. Developers that stay in the business long are highly aware of this and you want to be one of those developers.

Phil