Sunday, April 14, 2013

What is Code?

You've probably heard the term 'knowledge worker.'  It's one of those terrible euphemisms like 'sandwich engineer.'  But, for programmers, I think it's actually apt.  What are the inputs, outputs, and substance of our work?  Knowledge.

Andy Hunt and Dave Thomas, the pragmatic programmers, explain:
"As [programmers], our base material isn't wood or iron, it's knowledge. We gather requirements as knowledge, and then express that knowledge in our designs, implementations, tests, and documents.  We collect, organize, maintain, and harness knowledge. We document knowledge in specifications, we make it come alive in running code, and we use it to provide the checks needed during testing."
All craftsmen work in ideas.  But code might be the closest thing to pure thought that a person can build in.

What does it mean?
Painting, for example, manifests ideas, but you have to bring those ideas to a work when you view it.  Medieval paintings of Christ or Neoclassical paintings like the Oath of the Horatii make sense only if you know the story.  This is also true of contemporary art.  Most exhibits require a write-up in order for them to be comprehensible.

The thing about code is that it itself provides the background.  You need to bring an an understanding of syntax, but not semantics.  Documentation or knowledge of the industry should help you grasp the knowledge contained in code, but the code can stand alone and manifest its ideas clearly--if you know how to read it, of course. 

Interestingly, both written language and algorithms were invented at around the same time in Mesopotamia.  (It's also interesting that written language was invented as a tool of commerce and state power, but that's another post).  The word 'logic' comes from the Greek 'logos,' which means both 'word' and 'reason'.

It's all Sumerian to me.
In a program, we try to implement business logic with application logic.  I used to thing both terms were buzzwords, but I particularly like 'business logic' now.  It makes clear that there is a system of interconnected ideas that code should express.  In fact, one of the hardest things we have to do is to get users to come up with requirements that are logical.

Of course, things weren't always this good.  Object oriented programming and relational databases let us code in terms of objects and relations, which are self-defining.  This is much better than pushing and popping stacks, which have a tenuous connection to any business reality.  Still, even objects and relations have their limitations.  With all the advances in coding productivity in the last twenty years, I'm excited to see what new thought patterns we'll be able to have in the next twenty.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...