Wednesday, December 18, 2002

art of computer scripting

I chanced upon a three-volume book and a series of articles in a journal back in my university days, which from then on changed my perspectives towards programming.


The book is written by D. E. Knuth, entitled The Art of Computer Programming, and the series of articles, which originally appeared in the Communications of the ACM between 1983 and 1985, entitled Programming Pearls are written by J. L. Bentley.

You will be surprised to find the book or the articles too technically inclined and sometimes mathematically involved, in explaining the issues of computer performance, the concepts of data structures, sorting, searching, and algorithm. It will hardly ring any bell why someone would call programming an art or treat it like a pearl until you are experiencing the joy of programming.

I taught Macromedia Authorware, version 2 then, in a Multimedia Authoring class. I was having difficulties in understanding my students' programs as well as struggling with maintaining those that I developed.

Equip with structured programming knowledge and object-oriented concept, I decided to develop a search engine, sort of, within Authorware that would allow the program to branch to anywhere in the programs without using the goto construct (Rahardja, 1995). It was only years later that I found out this structured program construct was similar to the framework construct in the version 5. I was truly enjoying the discovery of a new authoring method using my existing knowledge in software engineering.

In my preparation for the Macromedia Director Lingo lessons, I was experimenting different approaches, ranging from hard coding to object-oriented approach, to develop a spaceship-shooting game. In these experimentation, I discovered the Lingo implementation of inheritance, message passing, and encapsulation. These discoveries and working on the various alternative solutions were indeed a great learning experience and had given me lots of fun.

When developing the game, I was not able to control the direction of the missile after it was released from the gun. The missile somehow would be steered away when the left or right arrow key was pressed. After spending almost two hours to troubleshoot the problem, I managed to localise and identify the problem and ultimately solve the problem. The problem was due to my oversight in excluding the one statement in the if-then-else statement. You can imagine how thrilled I was when the problem was finally solved.

Teaching programming or scripting language was never an easy task. I have been wondering how I should teach Director Lingo scripting to my students so that they would learn not only the language but also the skill in learning a new language. I hence decided to teach my students problem solving instead of the syntax and commands.

I would stress the importance of understanding the problem situation, representing the problem diagrammatically, identifying the critical components for proof of concept, selecting an appropriate data structure, developing and walking through the high level algorithm, and searching the commands for implementation. I could never tell you how much I enjoyed myself in finding an unorthodox approach to teaching a scripting language, and the pain and happiness in engaging deep thought with the feedback received from the students.

You would have been guessed right by now that my view of art in computer scripting is purely from the viewpoints of loving the kind of challenge it presented, finding the best solution from the various alternatives, making the program not only efficient but also correct, and finally constantly learning new knowledge and acquiring new experiences along the way.

Aren't these passion, joy, and sharing what artists felt towards art? Whatever it is, whether I am right or wrong, this is the message that I would like to share with all potential programmer: computer programming or scripting is both an art and science. It is not dry, abstract nor tough if we look at it positively from another point of view.

What do you think?

Reference:
Agus Rahardja, 1995. Multimedia System Design: A Software Engineering Perspective. In D. Jonassen & G. McCalla. Proceedings of International Conference on Computers in Education (ICCE) 1995.

No comments: