Sunday, November 22, 2009

Getting the bigger picture right

Today in India a very large number of students are chasing careers in software industry. They all seem to have a rather narrow view of the opportunities; they all think as if they are going to write a new operating system, DBMS or network protocol. While a handful of them might get the opportunty, there are many opportunities that are equally challenging!

As with other industries software industry is maturing too. While one can always improve on existing core software the billions of users will not accept anything new unless it is dramatically better. That is one reason very few of todays students will get to write one more operating system.

With software entering every facet of human activity - banking, manufacturing, telecom, education, healthcare, hospitality, travel or government - there are much larger opportunities in the application area.

With core software companies like Microsoft and Oracle having to support a very large number of platforms and environments there are opportunities to add functionality, supply tools, improve performance and to maintain the huge base of software that has been created.

To support so much activity a mammoth IT infrastructure has been created - servers, storage and networks. You need significant software expertise to manage this IT infrastructure.

Many other activities including engineering design, media and publishing are finding software to be central to their function; all of these activities are software enabled. There are plenty of opportunities in these areas as well.

In a nutshell, software industry offers a huge opportunity; do not limit it by your own short-sighted thinking.

Remember there are a very large number of temples for Lord Vishnu, smaller number for Lord Siva and a handful for vLord Brahma. So is software. Very large number of jobs in maintenance but very few jobs in new software creation!

Sometime back I wrote a piece on "Let thousand flowers bloom in the software garden" in Times of India. Do take a look if you are interested.

Thursday, November 19, 2009

How Does One Write Programs that Display or Print Themselves?

On 13th November 2009, I wrote on "Should Interviewers for Entry Level Programming Positions be "Trained" in Interviewing?" While the posting was about interviews, interviewers and out-of-the-ordinary questions, what appeared to have attracted the attention of student readers is the part about "writing programs that display or print themselves".

The most frequently asked question appears to be "How does one write programs that display or print themselves?" I will guide you to sites on the Internet that would help you learn how to do this.

A program that displays or prints itself is called a quine. This is named in the honor of Willard van Orman Quine, the American philosopher and logician. You can read about Quine and his contributions in Wikipedia.

I will describe at a very high level one possible method to implement a quine. The implementation of a quine consists of two distinct components. One of the components contains the definition of a string, and the other component is the program itself. The string itself contains the central part of the source program in the second component. The second component that contains the central program itself prints the string two times. The first time is to print the string definition. The second time is to print the central part of the program itself. This is the basic principle on which many quines are written. But writing the program itself could mean a lot of work.

Those of you who are really interested in learning how to write a quine must go through Igor Ostrovsky's blog on "How to write a self-printing program". Unfortunately, to understand this, you must be familiar with C#. At any rate, it does not hurt to read this well-written blog.

Over the years, many programmers have written quines in several languages. Quines are written in C, C++, Java, JavaScript, Perl, Python and several more. You must take a look at The Quine Page!

I am directing you to a few website that discusses quines to just satisfy your curiosity. If you do not understand how to write quines, do not be disheartened. If you had really gone through the Wikipedia, tried to understand what Igor Ostrovsky wrote about developing a quine in C#, and checked out The Quine Page , it would have been rewarding enough. But do not stop there, think of questions like "Are quines just oddities?" or "Do they have any useful applications?"

Wednesday, November 18, 2009

Would Learn by Doing be Effective at College?

In one of my postings, I emphasized the role of Learn by Doing in the process of learning computer programming. Many teachers agreed that learn by doing is good, but it would be ineffective at colleges in India.

Let us take the context to be the teaching and learning of computer programming using the programming language C as the first course at college. Barring a few notable exceptions in some of the top rung institutions in India, most of the others place an undue emphasis on teaching the syntax of the programming language. The time allocated to the learning of problem solving is almost negligible. Do ask the students who come out of these institutions to confirm this.

I think that this misplaced emphasis on the syntax of programming language happens mostly due to the structuring of the course to have “theory” classes and “lab” classes. Apparently, the teachers teach students the “theory” part of computer programming and the students practice programming in the "labs". And what would that mean? The teachers say that they teach “concepts”. That seems reasonable since one perhaps learns the conceptual and other foundations in the “theory” part of the course and practice learn by doing in the “lab” sessions. Sounds good, so far!

So why am I cribbing if students are indeed learning by doing in the lab part? The intentions may be honorable, but the ways these “lab” sessions are executed are a disgrace. Students are provided with a problem description. They are supposed to solve the problem, write the program, and get it executed. This is where certain disgraceful behavior happens. Several students have told me that during these sessions, they are also given the source program that solves the problem. All they need to do is to type the source program, get it compiled, see that it works as intended with a few test cases that are also given, and show it to the person-in-charge to be awarded the marks for that session. Is this exaggerated? Empirical evidence seems to suggest it is not!

Most students end up getting somewhere in the range [45,50] marks with the maximum marks being 50 in the "lab" component. Of course, the scores in the “theory” part of the exams show a wide dispersion. The bottom line is that a large number of students cannot program at all at the end of the course, whatever the marks they obtained in the “lab” part. Contrast this with excellent institutions like the IITs and BITS, Pilani where the "theory" and the "lab" are not disembowelled and the two components are seamlessly integrated! Grades obtained by students would correlate well with the ability to perform. Of course, you could come across students whose grades are not-so-good but their ability to perform is excellent. They are exceptions, however!

So, for learn by doing to be effective at college, there ought to be quite a few changes. Teaching, learning and assessments must all be aligned. The current practice of conducting the “lab” component is pathetic, and must be overhauled completely. The so-called “theory” component must be seriously examined and pragmatic practices adopted. Unless the colleges, and the universities that deal with them, adopt an “outcome based education” where competencies are clearly documented, and the assessment systems aligned to those competencies, the learn by doing methodology may be ineffective.

For students, my strong recommendation is to adopt the learn by doing approach notwithstanding how your university and college deal with outcome based education. After all, it is your life and you have to exhibit certain competencies in your job!

Sunday, November 15, 2009

Who are the Role Models of Computer Science & IT Students?

Computer Science & IT are hardly “traditional” disciplines of study. They are only about six decades old. In contrast, mathematics, physics, and chemistry and some of the disciplines like mechanical engineering & civil engineering are a lot older. Computer Science is an emerging discipline. There is one striking difference I see between the students of computer science and say, of mathematics or physics. Students of mathematics or physics take great pride in scientists who have made breakthrough progress in these disciplines. These scientists have inspired generations of students by being their role models.

So we have people like Albert Einstein and Stephen Hawking in physics, and Srinivasa Ramanujan and Pierre-Simon Laplace in mathematics. In Computer Science, too, there have been great personalities. But alas, very few students can name these persons and state what they have contributed to Computer Science.

The good news is that students know about Bill Gates, Linus Torvalds and Steve Jobs. The not-so-good-news is that they may not have heard of John von Neumann, John Backus, Alan Turing, Alan Kay or Donald Knuth. Very few can articulate the major contributions of each of these persons. The sad fact is that the students of computer science do not spend enough time and energy to learn about the greatest computer scientists and their contributions. A large number of teachers do not bother to provide this information in class either out of a misguided focus on “completing the syllabus” for the course or out of pure ignorance.

Why should I know about the greatest computer scientists and their contributions? What benefit will I get in investing my time and energy on this activity? Would I not be better off studying my prescribed syllabi and crack all examinations? Would I not be better off becoming more competent in some of the areas of computer science rather than know about the history of computer science?

All these questions are valid. None of them are trivial or improper. To question is to begin an inquiry and that is a good trait. After your intense inquiry, I really mean “intense inquiry”, if you do come to the conclusion that knowing about the greatest contributors of computer science is indeed detrimental or inconsequential to your progress, you are welcome to focus on what you think will be best for you. The teachers amongst you must inquire too.

Learning about the greatest personalities provides the context for our learning. Reflecting on the contributions and lives of iconic figures provides an opportunity to appreciate the culture, significance and relevance of the discipline. It enables one to develop a panoramic view of the discipline rather than a tunnel vision. I think that like in all disciplines, having a role model in computer science & IT helps.

Are our students aware of the immense contributions of great computer scientists like Edsger Dijkstra, Alan Kay, E.F. Codd, Niklaus Wirth, Alan Turing, Donald Knuth, or Barbara Liskov? Can’t we as teachers make our classes less insipid by providing inspiring context through reference to interesting personalities, their contributions and their lives?

I will make one posting each week on a person who has made immense contributions to computer science & IT. Watch this space, folks!

Friday, November 13, 2009

Can programming skills be taught to just about anybody? (contd)

This is what Professor Sadagopan says in response to my earlier post:


While I agree to a large extent, I do differ on one count. For some reason there is too much emphasis given to "logical thinking" (left brain) than "creative thinking" (right brain). Some of the best programs (MS Excel, Apple Mac OS, Adobe Illustrator) are created not always by those very good in "logical thinking" but those well versed in "beauty" (interface, interaction, aesthetics). So my conclusion ANY PERSON CAN MASTER PROGRAMMING if (s)he wants to master it!

Should Interviewers for Entry Level Programming Positions be “Trained” in Interviewing?

I know that I am going to raise the hackles of quite of few professionals in the IT industry. Would it help, if at the outset, I affirm that what I state here is without malice? I hope so…

Some months ago, one of my students told me that in an interview at a large company in Bangalore, the interviewer asked him to write the smallest C program that is possible. This student is quite intelligent and competent. Baffled as he was, after a few moments, he wrote the following program.

void main() {
}


The interviewer apparently did not think that was the appropriate answer. And after a couple of questions about the college in which he studied, the interviewer terminated the interview. The student did not get selected for a job. He still thinks that he was rejected because of this particular question & answer. The student may be wrong, and the interviewer would possibly have other reasons for not selecting him. I told this student so, and gave him a few words of encouragement.

The student then asked me how this answer could be wrong. This is a complete C program. It compiles correctly. It executes correctly, even though it does not do anything useful. Has he missed something to make this program even smaller? I had to confess that this program could be the smallest, but absolutely useless C program that I have encountered. But I have no clue what the interviewer had in mind when he declared the answer incorrect. Nor do I have any clue why such a question had to be posed at all in an interview? If you have any clue, please do share your thoughts here…

I was present in an interview several years ago as one of three interviewers. One of the interviewers asked the student to write a C program that prints itself. Now that is a valid question in that it has a solution. It is extremely difficult for a student to answer it correctly within the few minutes usually available in an interview. Take a look at one solution.

#include
main()
{
char *val1 = "main(){char *val1 = %c%s%c; int val2 = '%c'; printf(val1,val2,val1,val2,val2);}";
int val2 = '"';
printf(val1,val2,val1,val2,val2);
}


At first sight it is unlikely to make sense. For many it is unlikely to make sense at the second sight, the third sight, etc. You can compile and execute this program. You will find that this program displays itself. Pretty awesome, isn’t it? I will write about such types of problems one of these days! But is it the type of question one must pose a student in an interview? Perhaps the interviewer wasn’t really looking for a solution, but wanted to hear the approach of the interviewee! I still remember the baffled look on the face of the student, then. Roughly 15 years have passed since this incident. I wish I could communicate with the student and find out how he recollects this episode!

Looks like a section of the interviewers need to be trained on developing interviewing skills. Several companies in the USA do train their potential interviewers. Some do in India too. What is required is a cognizance that untrained, egotistic and over-enthusiastic interviewers can damage the psyche of youngsters!

Can programming skills be taught to just about anybody?

"Can programming skills be taught to just about anybody?" or "Can anyone become a good programmer?" Ravi - Thanks for this interesting question.

I am going to share my view on this - and Raja will follow up with a post reflecting his view:)

Answer: No, I don't think anyone can become a good programmer. Just like every branch of science or technology, programming requires a very keen mind with an above average IQ. One also needs to have a fairly good grasp of "logic" in order to become a good programmer.

Question: Can everyone with an above average IQ be taught programming? After all, above average will still cover half the world population:) 
Answer: Yes, I think that every person with a reasonable IQ and a good grasp of knowledge can be taught programming.

Question: Will every person who is taught programming become a good programmer?
Answer: No. What differentiates good programmers from the not-so-good ones is practice. This is not very tough to understand - every one of us plays cricket, but we don't all become good cricketers! It takes a lot of dedication and practice to become good.

Question: Is every good programmer a good software developer?
Answer: Oh, absolutely not. Being good/great at coding does not make you a good software developer.
Beyond coding, software development involves a number of other important steps including understanding and capturing requirements, translating these requirements into features/functionality, applying relevant technologies that best address the situation, performing design and analysis, laying out a development plan, developing test plans, documenting everything well, managing releases, etc.
So, if you are looking to be a good software developer, my advice to you is: please look beyond C, C++ and Java and start looking at all aspects of software development.