Sunday, June 15, 2008

Pointless Code

In a Java Bean class:

(I came across this recently in the code-base)
...
public String string( ) {
if (someCondition) {
return new String("someString")
}
return null;
}

In the code above, new String("string") creates two objects:one, for someString itself - JVM handles strings in a unique way, every string literal is a string object, per se and two, for new String(" ") operation - someString can be a field, an instance variable or a hard-coded string value.

It's pointless to return an explicit copy of String instance when none is needed and the case in point is the java bean class which is to be written only for setting and getting properties and nothing else.

Nirvana - Enlightenment - Jnanodaya

I've finished reading Siddhartha by Hermann Hesse. It only draws me back to re-read those pages again and again, because the philosophy behind this, although I could mostly identify my very own with it, could only be grasped by an immortal or at least, it could take a mighty long time for me to grasp the whole. It's no less than a cult literary work. Here's my review on this book.

Set during the time of Goutama Buddha, this novel talks about the events that occur in the lifetime of Siddhartha(Not Buddha, who was earlier known as Siddhartha), a young Brahman, who leaves his family for a contemplative life and undergoes radical transformations in his body and soul, comes across people whose characters are reflective of different spheres of life, learns a lot of things from things and not words, discovers beauty of nature and tries to find peace with nature, and near despair, in his old age, attains perfect wisdom and Nirvana or Jnanodaya or Enlightenment. It's a story of timeless truths cleverly depicted with great degree of simplicity and authenticity.

The fact that Hesse, the writer, from an alien land(Germany) talks about Hinduism, surely, is an eye-brow raiser. His effort in bringing out some of the subtle facets of Hinduism in a simplistic manner is truly exceptional. I should admit that Hesse displays a wonderful knowledge of aspects of Hindu philosophy. He quotes Vedas, Upanishads. It's his knowledge and not his wisdom though. As far as wisdom is concerned, here's what he's to say:

(When Siddhartha is confronted by Govinda, his best friend in the discussion about Knowledge and Wisdom)

...

Look, my dear Govinda, this is one of my thoughts, which I have found:
wisdom cannot be passed on. Wisdom which a wise man tries to pass on
to someone always sounds like foolishness."

"Are you kidding?" asked Govinda.

"I'm not kidding. I'm telling you what I've found. Knowledge can be
conveyed, but not wisdom. It can be found, it can be lived, it is
possible to be carried by it, miracles can be performed with it, but it
cannot be expressed in words and taught. This was what I, even as a
young man, sometimes suspected, what has driven me away from the
teachers.

I have found a thought, Govinda, which you'll again regard as a joke or foolishness, but which is my best thought. It says: The opposite of every truth is just as true! That's like this: any truth can only be expressed and put into words when it is one-sided. Everything is one-sided which can be thought with thoughts and said with words, it's all one-sided, all just one half, all lacks completeness, roundness, oneness.

...


About learning from teachings and "things", he's this to say:


(Again during an argument that Govinda throws up, when both of them meet during their old ages)

.....
...

Govinda said: "But is that what you call `things', actually something
real, something which has existence? Isn't it just a deception of the
Maja, just an image and illusion? Your stone, your tree, your river--
are they actually a reality?"

"This too," spoke Siddhartha, "I do not care very much about. Let the
things be illusions or not, after all I would then also be an illusion,
and thus they are always like me. This is what makes them so dear and
worthy of veneration for me: they are like me. Therefore, I can love
them.

And this is now a teaching you will laugh about: love, oh
Govinda, seems to me to be the most important thing of all. To
thoroughly understand the world, to explain it, to despise it, may be
the thing great thinkers do. But I'm only interested in being able to
love the world, not to despise it, not to hate it and me, to be able to
look upon it and me and all beings with love and admiration and great
respect."

.....
...

While I've watched the movie by same name, based on the same novel directed by Conrad Brooks , I found the book more interesting and more meaningful, for the book does more justice to the spirit of Siddhartha than the movie; This book's a bundle of wonderful nuggets of knowledge, of wisdom, of aspects of life that're central to Greek, Egyptian philosophy or civilizations and so on, so forth. What's of more relevance and of appeal is Hinduism though. This, by far, is my most favorite read and sits right at the top in my classics' collection.