I approach programming as an exploratory process. I can’t seem to bring myself to sit down and plan a program out in minute detail beforehand. The truth is, any program that I understand well enough to plan out in minute detail beforehand, doesn’t interest me in the slightest. I want my programs to teach me something I didn’t know when I started writing them.
Consequently, I usually start out with some vague idea for a program. I write the shortest little bit that might work and compile and run it. Even better, I use an interpreted language like Lisp or scheme or ruby so that I can skip the compile part. I love dynamic languages!
At first, I find myself exploring the boundary between the language and the environment. For example, I have spent hours exploring the Dir
module in ruby. I have spent similar amounts of time exploring similar functionality in Common Lisp. Knowing how to traverse the file system in a given language is an important detail.
Another facility that I often dwell on is the reflective capability of a language, that is the ability of a language to know or discover details of its structure. For example, most symbols in ruby have a method methods
that returns an array of methods that the object implements. methods
is a reflective method. It allows the programmer to discover details about the programming environment dynamically at run time. Reflection is also called introspection.
Java implements reflection, demonstrating that languages not typically considered dynamic can be introspective too. The clever trick to Java reflection is that Java doesn’t create data structures to describe itself until you actually need them. This adheres to one of my favorite principles that states “you shouldn’t have to pay for features that you don’t use.” I’ve heard this principle called parsimony.
The underlying theme to these language features is that they all help make a language more adaptive. One of the key characteristics of human intelligence is our ability to distance ourself from a situation and analyze it with detachment. This is an important part of our ability to adapt to rapid changes in our environment. The ability of someone to reason about their relationship to their environment is essential to intelligent behavior.
Now I’ve really tipped my hand. The romantic notion that has captured my imagination is the quest for emergent intelligent behavior or Artificial Intelligence as it is commonly called. I try to avoid the term Artificial Intelligence because I find that neither the word Artificial nor the word Intelligence lend themselves to unambiguous definition, much less objective measurement. In fact, many of the great debates in the field revolve around this shortcoming.
To be continued.