Inactive Code Yet Active


I have read that there is a comment preceding the task-switching code in UNIX as –

/*You are not expected to understand this*/

Humorous side of the programmer aside the comment does indicate that there are beasts out there which are difficult to exorcise, isn't?

Well, the reason I recalled the above is due to the fact that I spent  sometime of the day dumbstruck reading some code. I was lead to believe I am not supposed to understand one particular huge function. I was wondering how the code execution path can be in such way the reading informed me while the actual testing showed otherwise.  It was bizarre. I was telling myself that this cannot happen but the code seemed shouting loud that it was possible. But hey! Everything, even if not explainable at the outset should have some explanations and I stuck in to figure it out.  Alas, it was my ignorance of some fact, simple fact.

The function that I was debugging had the following:

           #if 0


           //some statements


I wasn't aware that the brace seen above gets accounted for by the editor (vim and source-insight). The editor didn't discount the ‘}’ inside the inactive code and hence when I navigated the conditions and loops I was taken for a ride. An ‘else’ was getting matched with unrelated ‘if’ that had me perplexed.  I had to stare at code and jump the loops and conditionals one by one to understand what the reason for my frustration was.

Some learning there!

A Mathematician’s Apology


Reading G.H.Hardy's 'A Mathematician's Apology', I couldn't help myself feel a little unworthy (will elucidate later). Hardy puts forth fitting arguments for mathematics and exalts the act of pursuing mathematics for the sake of mathematics and without being worried about its implications. The treatise was written when he was past his prime. For Hardy, mathematics is a young man’s game and he must have been prodded to write about mathematics for he was believer in doing things and not talk about it. His words might sound condescending but we get to get his mind as he expounds his reasons in the writing.

The function of a mathematician is to do something, to prove new theorems, to add to mathematics, and not to talk about what he or other mathematicians have done. Statesmen despise publicists, painters despise art-critics, and physiologists, physicists, or mathematicians have usually similar feelings: there is no scorn more profound, or on the whole more justifiable, than that of the men who make for the men who explain. Exposition, criticism, appreciation, is work for second-rate minds.

He alludes to the fact the mathematics in its purest form is nothing short of or even better than poetic lines of great depth. And his confidence in his own craft is telling and I couldn't help nodding positively reading the following lines –

I should say at once that my defense of mathematics will be a defense of myself, and that my apology is bound to be to some extent egotistical. I should not think it worthwhile to apologize for my subject if I regarded myself as one of its failures. Some egotism of this sort is inevitable, and I do not feel that it really needs justification. Good work is no done by ‘humble’ men.

Just like how a master poet playing with words brings forth great lines, mathematicians are makers of patterns made of ideas, patterns that are beautiful. He asserts that the patterns must be beautiful and if they aren't they are not worth pursuing. As examples of ideas that are simple yet profound and possessing inherent beauty Hardy describes Euclid’s proof of the existence of infinite primes and Pythagoras proof of irrationality. One cannot disagree. Even a person with no practice in mathematics can see the beauty of the proofs. I liked the lines that Hardy uses why reductio ad absurdum is so appealing for Mathematicians –

 The proof is by reductio ad absurdum, and reductio ad absurdum, which Euclid loved so much, is one of a mathematician’s finest weapons. It is a far finer gambit than any chess gambit: a chess player may offer the sacrifice of a pawn or even a piece, but a mathematician offers the game

The other aspect that Hardy argues and argues he does with rigor is the difference between pure mathematics and applied mathematics. Hardy rates pure mathematics highly and takes comfort with the fact that his and other real mathematician’s work finds no place in utility for mankind. It is useless in making life better, yes, he argues, but at the same time it does play no role in war as does the applied mathematics.

There is one purpose at any rate which the real mathematics may serve in war. When the world is mad, a mathematician may find in mathematics an incomparable anodyne. For mathematics is, of all the arts and sciences, the most austere and the most remote, and a mathematician should be of all men the one who can most easily take refuge where, as Bertrand Russell says, ‘one at least of our nobler impulses can best escape from the dreary exile of the actual world.

 Hardy must be forgiven for having not much foresight! His favourite line of mathematics – Number Theory –plays a crucial role in cryptography and other applications that do practical good as well as evil. Hardy belabours to get the distinction between pure and applied mathematics through and I found it at some places difficult to grasp the gist. Some chapters are pending further reading for better understanding.

Hardy ends the essays with one chapter which in substance touches the life he lived as a mathematician. He considers his collaboration with Littlewood and Ramanujan as his best works and his craft being bound with them.

All my best work since then has been bound up with theirs, and it is obvious that my association with them was the decisive event of my life. I still say to myself when I am depressed, and find myself forced to listen to pompous and tiresome people, ‘Well, I have done one the thing you could never have done, and that is to have collaborated with both Littlewood and Ramanujan on something like equal terms.’

He makes a case for himself and rightly so by acknowledging that he added something to knowledge (even if useless) and helped others do the same.

Reading Hardy’s defense for mathematics and its craftsmen I rued how wrong was it on my part for not taking mathematics seriously. Yes, I knew that mathematics is an art. I could appreciate its beauty (I despised shortening the subject to and calling it 'Max'). But still didn't excel and pursue it. Unlike other art forms like poetry or painting many of us have formal education for mathematics for many years. Still, I failed in mastering the art thus wasting an opportunity. But one can defend that software writing - beautiful software at that and debugging software also to be an art though Hardy would not put anything on par with mathematics! So, I at least have an opportunity by means of my profession to ace in some form of art.