Why is Programming so Hard?
I'm sure many of you have written just as many lines of code over the years as I have. Have you noticed that other than garbage collection and object oriented programming, precious little has changed in programming over the past 50 years?
The IDEs are grand and ameloriate the situation somewhat, but it still comes down to writing code for each tiny little action.
I assigned my introductory class a project to write part of a student dating system a few years ago. My description of the project was terse:
"The 'Tufts Blind Date' system will pair up students for dates to interesting college events, based on a compatibility metric. Students will enter this information into the system: contact info, physical info, areas of interest, preferences in a date. The system will then pair them up based on preferences and mutual areas of interest and suggest a school event, also based on their interests."
My students were able to construct a program that did just that based solely on this description. It took them many, many lines of code to do so.
Why couldn't a system simply work off of my description like the students did?
There's a lot of leeway for vastly different implementations based on my description, but that's OK. I have no problems with refining the system after it's built.
Obvious examples of possible under-specification include: What's contact info? What's physical info? What are the possible areas of interest and how will they be compared? How will they be contacted?
I think contact info should be a well-defined term. 100 years ago it generally meant your postal address. 50 years ago it was a phone number. Now it's email. In 20 years, who knows what it will be! Let's finesse the situation by saying it's email.
Physical info is slightly less obvious. We'll go with a list: Sex, DOB, Height, Weight, Hair, and Eye Color.
Areas of interest is so wide open it could mean anything. We'll simply refer to the "Directory of American Associations and Organizations." Take all the keywords from that and we have a list of possible interests. True, that's a pretty darn big list, but we have put millions of person-hours into designing systems to allow selection from large lists, so I think the computer should be able figure out the details (pull-down lists, hierarchical lists, name-completion, etc.).
And as for "pairing them up," we'll make an simple definition. Every time two people have the same interest, we'll give 'em a point. When a preference matches a profile, we'll give another point. Highest point total wins the date. Ties will be resolved by random.
It's not much of a system, but it is sufficently specified in about 350 words that I would expect most programmers to come up with pretty similar systems.
But this is still not enough for the computer to figure out on its own.
Why not? Why do we have to drop to the level of specifying the exact list structure being used and all the loops required to make the pairing up work?
It will probably take 100x more characters to specify the system sufficently well for the Java (or whatever) compiler to produce a working program.
I don't expect a computer to be able to read my English description, but isn't there a formal syntax that would allow me to do the same thing in the same space?