Tuesday, December 5, 2006

Concepts and Relationships

The Cognitive Dimensions of Notation vocabulary calls what I'll discuss here "closeness of mapping". Translation between programmer thought and program notation is difficult. Less required translation is better. So strive to allow the human to express his/her concepts as close as possible to his/her natural way.

What is the natural way we represent concepts? To answer intelligently I'd have to be a psycologist. But I'm pretty sure that any code is not natural. It becomes second-nature to skilled programmers, but only after extensive training, such that us programmers can think directly in the concepts and even language of certain types of computer code.

First observation: we don't express all our concepts the same way. Yes, eventually everything gets stored as connections and signals between neurons, but I don't interact with my concepts that way, or at least I don't try to explain them that way. To explain a mathematical concept, I may lead you through a bunch of symbols and equations. But if you didn't know what the word "mother" meant, I'd try to explain it in much different ways. Perhaps I could express it as symbols and equations, but I'm not sure that would help you.

So on the micro-scale, there is no one optimal language. In other words, tagline 2: "The solution to the problem of programming is not to develop another programming language." In fact, for the low-level nuts-and-bolts, the languages we have are quite good. (Low- and medium- level languages are coupled with hardware capabilities, so as long as hardware stays basically the same, so does the language. I may bring up some alternate ways of doing hardware, now that parallel is hot, that make us re-think these low-level concepts like sequential execution.) Instead, we need to develop a programming environment in which normal humans can work with concepts and relationships in natural ways and eventually--eventually!--put together code.

Second observation: we care a lot about relationships between our concepts. In some schools of thought, concepts themselves are meaningless; only the interactions between concepts (and between concepts and the real world) are meaningful. For a current example of the stress on relationships, see object-oriented programming. But does "object" equal "concept", and "public interface" equal "interaction"? Yes, in some cases. Aspect-oriented programming is trying to capture the rest of the cases. But both paradigms dip shallowly into the richness of our concepts and their interactions, imposing strictness of hierarchy and syntax. [Interaction-oriented(?) programming is taking the first conceptual steps in the right direction here.] An object IS_A concept. So is an aspect, feature, interaction, whatever else we have these days. Let's just do what we always do when we see regularlity like this: generalize it. It seems that a relationship between concepts is itself a concept, or perhaps the instance of one. Oh, instantiation is a concept too. This is all a bit worrying from the where-do-you-stop point of view, but philosophy has the same problem.

Third observation: Our representations of concepts evolve. We often subconsciously refine how we understand things and communicate them.

I'm going to go ahead and post this, even though it's not really done.

Next: Rigidity, Corner Cases, and Syntax

~Ken

Communication and Clarification

Currently programming is a process of figuring out how to give the computer exactly what it wants in order to perform a certain task.

I want to redefine programming as a process by which a computer helps a human clarify and communicate ideas.

That bears unpacking:

process
Programming is already far more than edit-compile-run, although most traditional languages tie you to at least 2 of those stages. But when I think of "programming", I think of far more than just coding to the whole end-to-end process (if it does end) from an ordinary person having an idea to it being expressed clearly enough that a computer or other person can act on it. More comments on the other person aspect later [FIXME], but it bears saying now that I'd like a computer to be able to help us clarify what we mean when talking with each other.

The central focus is not the code developed, but rather the interaction between programmer and computer. Hence my tagline: "Programming Is Interaction".

Most human-computer interaction (HCI) research focuses on interaction with pre-built applications, such as OS shells, office applications, and websites. Some precious few have applied HCI concepts to programming, with some amazing results. I've written a whole report on it, which I'll post up here sometime [FIXME]. Summary: MIT Media Lab and CMU Natural Programming are the big ones I've seen. [Please let me know if you see any other big work in the field in academia.]

I'll unpack process a lot more over subsequent entries.

help
Humans aren't born knowing how to program. That is, we don't instinctively know (1) how to think logically and communicate ideas clearly, nor (2) how to express these ideas in a computer system. The computer should do all it possibly can to help. Automatic code completion (and in some cases, generation) is just the begininng; how about helping us with the basic reasoning behind it too?

clarify
Generally we don't start out with a perfect idea of anything. What is a "paragraph", or an "audio track"? I can try to give a definition, but surely in the course of developing the word processor or sound editor I will refine this definition quite a bit. My definition will probably not look much like "a paragraph is a _____." anymore either; it will mostly talk about how a paragraph relates to other concepts, like words and pages. ("Concepts and Relationships" will cover this issue in depth. [FIXME])

My initial definition is practically worthless for laying down application code, since refinements in my thoughts will almost certainly change the structure of the implementation. (Ideally my thoughts have the same structure as the implementation. [FIXME]) Yet errors in my initial characterization of the problem can go unsolved for the entire lifetime of the system I develop.

So the programming environment should help me clarify what I mean by a "paragraph", helping me keep my concept consistent (though forgiving me for being temporarily inconsistent -- see "Rigidity, Corner Cases, and Syntax" [FIXME]) while I refine the structure of my thoughts.

It should ask questions like, "What should happen if the area of the paragraph extends outside the page margin?" -- because I gave it the concept of paragraph area and page margin and it determined that the two could be in conflict. Or "what should happen if the first line indent is negative?".

communicate
Everything makes nearly perfect sense, as long as it stays within the confines of my mind. As soon as it tries to leave, it crashes into reality and comes out a mess. In the process of clarification, my goal is to communicate thoughts clearly. Communicating with a computer is far more demanding than another human, because it probably doesn't share my instinctive understanding of the way the world works. But if I've accurately explained my world to the computer, making my concept understandable to it also makes it more understandable to fellow humans. The number of courses we must take in writing shows how little we start off understanding about clear communication. So there's a lot that the computer can do to help. [FIXME: this section is weak and not clearly differentiated from "clarify". Perhaps they are really the same thing.]

ideas
Not algorithms, structures, or processes. I mostly covered this in "(Big-Picture)".

Next: Concepts and Relationships

~Ken

Monday, December 4, 2006

Problems with Programming (Big-Picture)

Teaching programming should be teaching teaching.
But it's not.

Programming currently requires much more skill than just communicating information logically. It requires:
  • translating ideas from concepts and formulations natural to humans to those natural to the machine. [The machine makes very little attempt to work with ideas the way humans do.]
  • communicating these unnatural concepts in an unfamiliar and cryptic code.
  • knowing lots of details about how things are done internally. [Programming has slowly been getting better on this count.]
At best, current programming environments provide means to navigate the code and show its operation line-by-line.

Worse, the idea of programming today limits the realm of logical manipulation to just what can be expressed as following a sequence of instructions. There is no concept of a concept, only what to do with it on a low level. What if we could logically manipulate
  • mathematical expressions - showing each step in a derivation for a textbook, for once!
  • laws - allowing politicians and normal citizens to explore what the effect of a law is in a certain situation
  • sciences - finally teaching a computer physics or chemistry, not just how to run the numbers behind it
  • language - besides the obvious application to translation, a computer being remotely able to manipulate language is a great help to language learners
  • techniques of engineering or other fields - say that someone has taught the computer the technique of least squares (in general); when I am trying to solve a problem that requires some sort of approximation, it offers the least squares technique to me, complete with how to actually do it and the conditions and assumptions I have to make
  • documents - beyond grammar checking to does this even make sense (and of course much better grammar checking also, with some help from rational annotation, which I'll get into later -- bug me if I don't)
That's just the beginning of the list. I'd venture to say that the kind of thing that will approach general instruction/teaching of a computer would not be called "programming", though for me the development starts there. I welcome suggestions for better names.

Next: Communication and Clarification.

~Ken

Programming as a Basic Skill

Too many people lack even basic programming skills:
  • Politicians try unsuccessfully to reason about how their actions will affect complex systems
  • Lawyers can't write clearly while being clearly understood
  • Doctors can't communicate their intuitions about medical conditions
  • Scientists make grave errors in their statistics
  • Teachers can't communicate their knowledge to students
  • and everyone commits logical fallacies regularly
People need to learn how to:
  • communicate their ideas clearly, and
  • interpret and influence interconnected behaviors that they can't manipulate directly
These are basic skills, perhaps more basic than arithmetic.

A computer's logic is impeccable, yet it can access, store, and manipulate vast quantities of information. So instructing a computer (classically called programming) is ideal for teaching these concepts.

But not today.

Next: Problems with Programming (Big-Picture)

Intro

[I'm merging my two blogs; this was the first post on reVision: The process of re-visioning programming as interaction, teaching, and idea refinement]

Welcome!

A friend suggested that I blog about some ideas I've had so I could get comments. So over the next few days I'll be writing about where I see programming and human-computer interaction now and where it should be.

I'm doing this to get some ideas out in the open and get comments. Please be wise about what you do with them.

~Ken