Tuesday, August 2, 2011

On relations and associations

If there's anything that puzzles me in life is the problem of association, or to put it more simple, how things relate to one another.

You see, everything is or can be related, associated, connected, chained or coupled together. Of course, that is, according to a certain meaning, context, scope, perspective, principle, etc.

Even things that seem so far apart can result being surprisingly closely related: the very well named "Theory of Chaos" (a lot of pun intended here) states that things are connected in such a way that a butterfly flying in Shanghai can cause a storm in New York City.

With regards to this last thought, one could guess that not only things are related, but they are chained in such a way that every relationship ripples to the next, and to the next, and to the next, connecting the dots, and thus creating a kind of balance.

Philosophers often ask themselves:

- How does language relate to reality?
- How does reality relate to different phenomenon?
- How does phenomenon relate to theories?
- How does theories relate to concepts?
- How does concepts relate to language?
- How does language relate to reality?

What is Object Oriented Programming but an ode to relations, connections, and associations? Terms like "class", "inheritance", "polymorphism", "base types", "derived types", "generic", "model", "binding", "pattern", and even "instance", "object" or "singleton" and nothing but indicators of "how" something relates to something else, or why not, to itself.

So knowing "how" to relate "things" is key to write good code, is that it? Well, yes... In part.

Although usually pointless, philosophers do come up with good questions: how does language relate to reality? Understand that now I'm referring to the term "language" as in "programming language". How does a few lines of code describe and solve a real problem in life? Just as we use words to translate whatever our senses present to us: hot, sour, smooth, tall, rank-smelling, can we describe our world, our lives, our reality through a computer program? Again, just as with words: sometimes we can, sometimes we cannot.

Gorgias, a pre-socratic sophist used to say:

1. Nothing exists;
2. Even if something exists, nothing can be known about it; and
3. Even if something can be known about it, knowledge about it can't be communicated to others.
4. Even if it can be communicated, there is no incentive to do so.

Of course you would be tempted to ask him why. And so, he would answer with another question:

"How can anyone communicate the idea of color by means of words since the ear does not hear colors but only sounds?"

Despite all that, there IS a relationship going on there! We might not be perfect at describing it, if we can do that at all, but that doesn't mean that the relationship CAN be made.

So one thing is certain: if you go ahead and try doing it, you should try your best to understand this connection we make in order to solve the dilemma at hand. Back to programming, this means that only when you understand and become aware of the relationship that binds reality to your thinking, and your thinking to your programming skills, and your programming skills to reality, and so forth and so on, only then you will get the most out of yourself. No principle or thumb rule can teach you that.

Well, this essay is actually "related" to a post about a nhibernate mapping model, but since it's taking some time to write, and it sort of became an article on its own, I will leave it as it is and hope you stay tuned for what coming next.

I'll be back!