Re: [Q]Any diff using Synonym vice Fully Qualified table Name?

From: Don Vick <dvick_at_lanier.com>
Date: 1995/05/02
Message-ID: <D7yE98.F9B_at_lanier.com>#1/1


In article <1995May1.122506.13774_at_newton.ccs.tuns.ca>, <James Richard> wrote:
>In article <D7tzLD.I0L_at_crash.cts.com> pme_at_crash.cts.com (Phil Melendez) writes:
>>To All,
>>
>>Is there any difference in performance when using synonyms vice the fully
>>qualified table name? Example:
>>
>> select emp_name, emp_code
>> from emp
>> where emp_name = 'John'
>>
>> select emp_name, emp_code
>> from misc.emp <--
>> where emp_name = 'John'
>>
>>
>>Thanks,
>>
>>Phil Melendez
>
>In performance, I don't know!!
>In simplicity, ease, and PORTABILITY of code, Yes!
>
>Eg
>
>Table A created by User B.
>User C also accesses this table.
>
>Table X created by User Y.
>User Z also accesses this table.
>
>Table A and Table X are defined the same and contain the same type of information.
>(but don't have to be named the same)
>Now...
>Form A uses Table A for User B and User C.
>Form A uses Table X for User Y and User Z.
>I use the same form for all users.
>
>In your case, Form A would use table EMP.
>EMP could be a synonym MISC.EMP or GARB.EMP, it doesn't matter,
>but you only need one form for all users.
>
>More overhead in keeping track of synonyms, but well worth the code portability.
>
>James Richard (JRICHARD_at_TUNS.CA)
>"No Assembler Required!"

This appears to be an argument that synonyms can be used to patch up the damage caused by denormalizing your database. (Tables A and X are parts of the same relation.)

There is an old proverb that says "The beginning of the solution to any problem is to call everything by its right name." Portability and many other "-ility's" are better served by having one name for each object and having everyone call the object by its name. If two forms really have to use different data, then they are different forms; disguising them as the same form by using synonyms just confuses maintainers later. This is why ineritance was invented, and eventually we will have better ways to implement it; for now, dicipline is the best solution.

Public synonyms should be reserved for objects that are truly public, like the data dictionary. Private synonyms are private and should not be part of a discussion about software engineering principles.

Don



Donald E. Vick (dvick_at_lanier.com, dvick_at_crl.com) Voice: (404) 493-2194 Fax: (404) 493-2399 Received on Tue May 02 1995 - 00:00:00 CEST

Original text of this message