Monday, March 25, 2013

Beauty is Our Business - Mathematics, Excellence and the Great Dijkstra


I remember here the lessons Dijkstra gave about beauty and excellence through personal examples. His colleagues celebrated his works with the salute: "Beauty is Our Business"[1]. Dijkstra is one of the most revered computer scientist whose footprint on the fundamental ideas in computer science is now legendary.


This was 1988-89. I was at The University of Texas at Austin, USA when my friend and colleague Mobashir R Hingorjo (who later became the founding director of TPS) came up to me and said let's take this course "Capita Selecta" by Edsgar Dijkstra. I had read about Dijkstra in computer science texts but had no idea what Capita Selecta meant. I showed my concern to Mobashir about how would this course be relevant to my direction of research, which was more towards software engineering, and less towards formal (mathematical) verification of programs. To this argument, Mobashir had a simple answer "Trust me. One day we will be telling people that we took this course by Dijkstra!" 

I had no intention of pursuing verification and mathematical correctness of programs, hence, I was less interested in the course contents and more interested in Dijkstra himself. I had taken the course on a non-credit basis to shield myself from any adverse grade that I may be awarded by this guru of computer science. We thus found ourselves in this Capita Selecta class of Dijkstra and what a memorable experience it was! This interaction with Dijkstra eventually became a profound lesson in my conception of beauty and my understanding of what it means to strive for excellence, and this I would always cherish.

I now often  share the following anecdotes with my students and to those I am trying to explain the concept of excellence. 

One day Dijkstra was writing an algorithm on the board. As he came down to the bottom end of the board, he found himself short of space. He had one line more to write and had run out of space at the bottom of the board. He had the option either to write the remaining line on the right hand side of the board which was blank or he could use the other slideable board on the right that could have slid on top of the first one. But, what did he do? He chose to rub all the lines of the algorithm that he had written, and then rewrote all the lines once again, but this time a little smaller, so that the remaining last line would also fit on a single page of the board. From top to bottom. No need for the line spilling over to another side of the board and becoming orphan. I wondered at that time what is this. Why is he wasting time. Now I know better. He was giving us a fundamental lesson in aesthetics and beauty. This effort invested in making your work proportional, balanced and visually appealing is the essence of the strive for excellence for those for whom beauty is their business. 

I remember one day his saying to us that he had never written a program that is more than a page long! I often wondered then what kind of programming he was doing. It was much later, after my software house venture failed that I learned the hard way; that any program (or function or procedure) that is more than a page long should be thrown away. On his authority, and my adverse experience of the tremendous loss that we incurred in the software house venture, I can safely say that one of the best methods of software quality assurance is that we should throw away any routine (or program) that can not be put succinctly on a page, better still half a page!

Add to this Dijkstra's conception of beautiful expression in the style and structure of the program and you have the most powerful quality control tool for programming. I think one is better off just throwing away a program that is not beautifully written with balanced and concise names. This is much easier than Fagan's Inspection Method which is a more technical implementation of the same idea. A program that can not be easily read is an expression of convoluted and imprecise thinking and should be immediately discarded. Trust me, I learned it the hard way.

I also recall the effort that Dijkstra would invest in coming up with short and very brief names of variables so that the reader can concentrate on the structure of algorithm and not get lost in the wilderness of long names. The strive for coming up with names and their prefixes would often take major amount of time. But the result of this effort was an elegant system of notation which had simplicity, brevity and directness often not witnessed in other areas of computer science. His remarks on the use of imprecise and loose language used in papers were scathing, ruthless and some of his lampooning of bad style is now legendary. See for example this analysis of Dijkstra of a document. If the imprecise and loose language used in reports and papers needs to be stringently criticised, then one can imagine what high standards are required in writing clean and neat algorithms and programs. His algorithms are supreme examples of beauty, elegance, and conciseness and so are the algorithms designed by his colleagues and students.

In another semester I was taking a class on Distributed Systems by Professor Mohammad Gouda, who was one of Dijkstra's true disciples. At the start of each class Prof Gouda would take several minutes to divide the board into three equidistant areas each separated by a vertical line drawn with chalk. He would take forever to make sure that the lines were vertical. Would rub a line many times and would draw the line again and again and would view the line from every direction until he was satisfied that his hand-drawn line was perfectly vertical, balance and dividing the board in equidistant areas. I wondered at that time, why was he wasting his time and ours. But, now I know. This must have been a lesson passed on by Dijkstra to his student and a true reflection of what is meant to have beauty as our business. Excellence is not an act but a Habit as mentioned by Aristotle, but I saw it in the example of Dijkstra and his students. Habit of excellence in every thing that we should do; whether it is making an algorithm fit on a page or whether it is drawing a line on the board. 

He was dead against the use of word processors, for the simple reason that they encourage shoddy thinking. You write first and then think later. All this ease of editing, cutting, pasting, revising and readjusting in word processors is at the expense of deep and precise thinking and should, therefore, be discouraged. I remember there was this colloquium in which the famous Donald Knuth ("Art of Computer Programming" and Tex/LaTex word processor) was making a presentation and it fell upon his old friend E W Dijkstra to introduce him. I was astounded to hear Dijkstra taking this opportunity to criticise Knuth for endangering beautiful and precise thinking with his word processing software. No wonder he was probably the only computer science researcher whose handwritten manuscripts were accepted for publications by journals for example see this wonderful paper. Just imagine the time, effort, pre-thinking and planning required in composing a handwritten page without crossing out sentences, overwriting and corrections. Think about the time we spend and the number of times we enter, cross out, revise, edit and re-edit a single line that we write using an editor/wordprocessor. Even with the help of spellers and what not, our writing is full of mistakes. There is a great deal to be learned about this maxim "think before you leap" that we have forgotten and continue to ignore when we write.

I will relate about what grade I got in this course in a later blog "Fairness in Grading: A lesson by Dijkstra"

Dijkstra Posts:


References:

Please note that the title of this blog is taken from the following conference:

[1] Beauty is our Business: A Birthday Salute to Edsger W. Dijkstra, Texts and Monographs in Computer Science is published by Springer-Verlag, 1990, Editors: Feijen, W.H.J., A.J.M. van Gasteren, D. Gries, and Jayadev Misra.

See Also:

What is PhD?
Why PhD is Difficult: 
Starting with your PhD
Reading Research and Writing your Research
Qualitative Learning from a PhD




8 comments:

  1. I am one of the student's of DR.Irfan and I have listen and learned the beautiful concept that Dijkstra had given to our teacher and he has provided to us.If anyone read this post carefully and understand it essence , i am sure his life will have a turning point.

    ReplyDelete
  2. "...fundamental lesson in aesthetics and beauty";
    "...conception of beautiful expression in the style and structure of the program..."; "A program that can not be easily read is an expression of convoluted and imprecise thinking and should be immediately discarded.";
    "I also recall the effort that Dijkstra would invest in coming up with short and very brief names of variables so that the reader can concentrate on the structure of algorithm and not get lost in the wilderness of long names. ";
    "Excellence is not an act but a Habit as mentioned by Aristotle, but I saw it in the example of Dijkstra and his students. Habit of excellence in every thing that we should do; whether it is making an algorithm fit on a page or whether it is drawing a line on the board. ";
    "Just imagine the time, effort, pre-thinking and planning required to a handwritten page without crossing out sentences, overwriting and corrections."

    Salam Dr. Sahab,
    I am commenting after a long time. I think your article on EWD stands on the above core sentences; commendable job sir!
    Really, we do read how to write, what to write and what not, but rules do not play any good role in one's life and writings unless practically displayed by people like EWD. Congrats on having written an illuminating article on a very right time. When you talk about excellence and beauty, it must be depicted in everything you do. It should neither be time bound nor based on performing a certain set of activities. When you are a perfectionist, you are a perfectionist, you can't look for excellence for sometimes and forget about it afterwards.
    It was enlightening. Thank you sir!

    ReplyDelete
  3. Business Mathematics ideas helping students to understand all those values which they must needed to observe and possibly for the future these would either way bring more of challenges for them.

    ReplyDelete
  4. Those are the possible values which would help students in bringing around all those prospects which are entitled for the better success along with grounds. So, indeed a lot to be made in this favor. write my essays for me

    ReplyDelete
  5. There are the better essentials made out in advance and hopefully for the future these would govern better grounds. Check electronic products best electronics product

    ReplyDelete
  6. We are of the better view and opinion and hopefully for the future these would provide more of the reflective details.

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. We are of the better view and opinion and hopefully for the future these would provide more of the reflective details. Please check electronic gadgets for details.

    ReplyDelete