Friday 14 August 2009

Why name prefixes are evil

Many programmers and database admins seem to prefix their variables or table names with a few letters to indicate the type of the entity. For example, for some reason unknown to me, most of the databases I have come across have "tbl" prefixed to every table name, and even worse I've seen "fld" (for field) prefixed to every column!

In a time where every database has a set of GUI tools to view them, which conveniently groups tables, views, stored procedures with their own icons... what benefit does this naming bring? To me it only seems to bring problems, I'll give you an example.

Where I work we inherited a set of legacy databases to build a new web application on top of, the old website needed to continue to function. We decided to reorganize the databases to make them easier to maintain. To remain backwards compatible with the legacy website, we created views to the actual tables to mimic the old design. Here is the problem, the views are now named "tblXYZ" instead of "vwXYZ", an annoyance, making the already pointless prefix naming, now down right counter intuitive. The only way to change this situation is to go back and change all the code that accesses the table and rename the views. A long, and potentially bug inducing process.

It's even worse with variable naming, if at some point down the line, you decide that your intVariable needs to become a fltVariable you need to go through an rename every occurrence of the damn thing, what advantage does that naming bring in either statically or dynamically typed languages?

Don't prefix names based on types. By all means prefix to prevent name clashes (member variable vs local variable) but prefixing based on a type is more hassle than its worth.

2 comments:

  1. Prefix of the name is vital for the visuals for all partners. The game of the https://www.methodspace.com/members/sandymiles006/profile/ is ensured for the prefix. Its value is generated for the suggestion for all partners for the team for all issues.

    ReplyDelete
  2. You should include your thesis statement into your introduction paragraph. It should unite GradeMiners all GradeMiners your arguments. Here are some main tips that will help you deal with such specific paper as 5 paragraph essay.

    ReplyDelete