Tuesday, November 27, 2012

Programming Demystified

If you wish to achieve something, don't just believe you can do it.  Believe you have already done it.  Feel it, desire it, experience it as if it was already there.  And as if it was easy.  Then go do it.
Ever since I first experienced a computer in the 1970's I've wanted to a) understand how they work, and b) make computer apps.  Understanding how they work was easy, just take them apart!  (no reassembly plan required)  Making computer apps was the mystery.  How do I get the computer to write my name?

It also turned out to be easy:

It's version 4 and it comes only in green.

Oh, so everything between the quotes is reprinted on the screen?  Cool!  Very useful.  Can it do more?

Did you notice the massive amount of memory?

And we have a program! (which apparently recognizes my brother and sister)

This is actually quite an achievement, because it can do it all over again.  Just write "run" and it will print the same names once more.  It executes a program.  But only until you switch off the computer of course.  Then it's gone.

Incredibly, more than 30 years later this is still how we make computer programs!

This might explain why triangles are useful
Yes.  That's true.  We have more colors than the human eye can see, we have surround sound in three dimensions, we can write a text message in Japan and it instantly reaches our friend in Berlin, and any old desktop computer can draw millions of triangles in a fraction of a second.  And it doesn't disappear anymore when we switch off the phone or computer.  But we still make programs by writing a little bit of text, and then executing the program.  This is true for the word processor you use to write invoices, for games you play on the iPhone, and for whatever browser/reader you use to read blogs!

I've tried to make programs for just about any computing device I've come in contact with.  This has led to experiencing 30 or so programming languages/systems, and at least (!) 29 of them have been text based one way or another.  Write some text.  Then run it.  That's how we make computer programs.

Maybe equally weird, we also still build computers the same way as then.  Before the 1970's there was actually quite a bit of diversity in how we made computer programs and how we built computers.  Then we discovered the integrated circuit, and suddenly the whole world aligned itself, and started focusing on faster and more.  And smaller.  Much smaller.  And much faster.

Smaller and faster is no small achievement though.  To put it into perspective, an investor may be content if an investment grows by 10% every year.  The improvement rate of computers has been around 40% every year.  Consistently.  For the past 40 years, and still counting!  Computers can now write the names of millions of siblings in the same time as two siblings in 1980. (though we may not have millions of siblings)  When something improves consistently with 40% per year, this is such a massive improvement rate that new uses of computers eventually become available even without other significant breakthroughs.  Like mobile phones.  There's nothing significant in a phone that a computer in the 1990's or 80's couldn't do.  But having so many things integrated in a unit that almost disappears in a shirt pocket, that in itself allows us to start using computers in completely new ways.  Just from them being smaller and faster.

Of course, printing names on a green screen is exciting only for so long.  Today we want our programs to look (and sound) like this:

Built with wxWidgets, this is from Mac OSX.

And suddenly our programs need to be more complex.  And they don't run on all computers or phones or tablets anymore.

The program that prints the names of my brother and sister had an interesting feature.  It would run on most available computers at that time, not only the Commodore Pet that this example is from.  And it ran on contemporary computers for another 15 (or so) years.

But if we still build all computers by the same principles, why can't all programs run on all computers and tablets and phones?  In my opinion, this is a valid question that people tend to forget to ask.  Like I mentioned in the prologue, we've pretty much accepted that there need to be barriers.  What's more, the barriers aren't there for technical reasons.  Apps are more complex today, but there aren't really any technical barriers to make any app run on any device.  If you want to know why Halo doesn't run on Playstation it's not the technical department you should be calling!

I won't go into that any further in this post.  But in future posts I will explain why I don't consider there to be any technical barriers (some people may disagree with that).  And why porting wxWidgets is a Pretty Cool Thing.


//A

"There is no order of difficulty in miracles. One is not 'harder' or 'bigger' than another. They are all the same."
- A Course in Miracles, Helen Schucman


4 comments:

  1. Nice post Andreas. Where in Sweden do you live? I hope you get your computer asap :-)

    ReplyDelete
    Replies
    1. Hey, thanks! I have words from the friends in Italy that it's on its way now, so not to worry.

      Delete
  2. Nice to check your post again, Andreas.. I find it interesting.. Hopefully others more will have fun reading your blogs. I especially like this - "If you wish to achieve something, don't just believe you can do it. Believe you have already done it. Feel it, desire it, experience it as if it was already there. And as if it was easy. Then go do it." That's inspiring.. :) Thanks!!

    ReplyDelete
    Replies
    1. Thank you K! It also has the nice property that one can celebrate even before the work is done! Meaning champagne more often.

      Delete