Magic is awesome. Take it as a
fact or be a cynic, but it won’t change its awesomeness. So what makes magic so
awesome? If I had to put it in a sentence or two then I’d say, it’s the
intimacy of illusions, drastically diminished distance from the seemingly
impossible and the ever green ability to make things appear and/ or happen out
of nowhere. Magic does things that are hardly aligned with logic. The very
essence of it is in the opaque interface that separates the miracle to the eyes
from the marvel of the brain that made it all happen. The fundamental idea
behind magic is nothing but an abstraction so absolute that the lines between
reality and fantasy are blurred to the extent of near extinction. The magician
desires nothing but an induction of belief in the audience’s mind that
something can be done, without them having to go through the details of how or
why. In fact I’d go as far as saying that the word magical can safely be used
as an antonym for the compound self-explanatory. Magic can’t be understood, or
else how would you expect it to amaze.
The train of thought I’d like you
to carry from the previous paragraph is that magic is esoteric and that too
intentionally. Magicians must hide how they did it otherwise the world is full
of keen eyes and ambitious minds to figure things out. As I’d introduce in the
subsequent paragraphs, such keen observers are sometime benevolent as well.
Sometimes it’s a bad idea to keep them from knowing the secret.
A similar trait of esoteric
abstraction can be seen in descriptive solution to a problem. An example of
this would be a computer program. A computer program is based on an algorithm,
the logic of which is meant to solve a problem. What this logic contains (commonly)
is a combination of instructions to be followed and decisions to be made, by
the machine. Often these solutions are dependent on very specific data. This
dependency is so specific that the programmer does not even have to store this
data in a variable. Why? Because the data is not going to vary. All that needs
to be done is writing that data down, in your program and let it work in order
to obtain the solution. For example, if I am writing a program to double a
given number then somewhere in the body of my program I would have to write the
following instruction:
Result = 2 * number;
In this statement, the number 2
is the kind of data that I am talking about. Now this example might not apply
to the criticism to follow. It is only intended to get you acquainted with the
notion of magic numbers. A rough definition could be:
A magic number is any constant written exactly, as part of an
algorithm, without having any contextual representation.
What I mean by contextual representation
is anything like a variable, or a macro assigned to such numbers that may
specify what their purpose is. It is not always as obvious is in the above
example as to why certain numbers are used in a solution. These can prove to be
as much of a nightmare as magic in general is like a dream to the observer. If
someone is willing to go through an algorithm and figure the logic behind it,
then these magic numbers are the primary hurdles among other things. They are
not abstracting, they are blatantly obscuring the straight truth: the real,
intended logic.
Magic numbers are necessary in
many cases, but what the author should avoid is using them directly. Bearing a
little overhead and assigning some descriptive macro to the magic number would
go a long way in enhancing the clarity of the solution and will ensure its
legacy.
Avoid using magic numbers,
abstraction should only be to the extent of ignoring details when there are bigger
fish to fry. Hiding something (permanently) should never be the intent (speaking
strictly in context to this post).
No comments:
Post a Comment