-1

I've seen a lot of article mentioning these 'Magics' like 'Magic Tables', 'Magic Columns', 'Magic Number', etc. What are they, really? Please give a concise explanation and example for these 'magics'.

[Edit]

The link below says that rownum is a magic column

http://www.oracle.com/technetwork/issue-archive/2006/06-sep/o56asktom-086197.html

Is it a general term?

Logos
  • 334
  • 1
  • 7
  • 17
  • Could you share a few links to these articles about "magics" in Oracle ? – krokodilko May 20 '16 at 07:37
  • @kordirko, I had the question edited – Logos May 20 '16 at 07:42
  • `RWONUM` pseudocolumn is explained in detail in the documentation here: https://docs.oracle.com/cd/B19306_01/server.102/b14200/pseudocolumns009.htm Please specify what is unclear to you about `rownum` ? – krokodilko May 20 '16 at 07:45
  • `rownum` is not a "magic" column. It's a documented "pseudocolumn": https://docs.oracle.com/database/121/SQLRF/pseudocolumns009.htm#SQLRF00255 –  May 20 '16 at 07:45
  • But, the article I mentioned above says that "ROWNUM is a magic column in Oracle Database that gets many people into trouble". Now I'm getting more confused -_- @a_horse_with_no_name – Logos May 20 '16 at 08:08
  • 3
    @Logos I think Tom meant "magic" as in "it does something behind-the-scenes that you don't get to see/be in charge of; you only see the results". That Arthur C. Clarke quote seems apropos here: `Any sufficiently advanced technology is indistinguishable from magic.` – Boneist May 20 '16 at 08:52

1 Answers1

3

I bet that the text is just using a metaphoric expression but there is a very similar term in programming called Magic Strings and Magic numbers. You can see in the wikipedia there are several meanings.

I personally think on the meaning of:

Unique values with unexplained meaning or multiple occurrences which could (preferably) be replaced with named constants

This means that it is better to write:

for(int = 0; i < MAX_ATTEMPTS; i++){

Than

for(int = 0; i < 20; i++){

See this stackoverflow answer for more information why magic numbers/strings is an anti-pattern

Community
  • 1
  • 1
borjab
  • 11,149
  • 6
  • 71
  • 98