|
|
Joined: Dec 1999
Posts: 30,867
Master Elite Member
|
I recently left my computer on by accident for a few billion years. I was working with Microsoft Word when I forgot to shut the computer down, so it was left open and running. When I came back and realized the computer was still on, the most amazing thing had happened.
It seems that cosmic radiation—which causes about 1 memory error per month in a typical home computer—had caused a portion of the in-memory code that makes Word work to be copied to another location memory block that did not contain any useful information.
Then, as the memory errors continued to occur, they wrote about 100,000 new machine code commands—bit-by-bit—and added a new feature to Word that didn't exist before. This feature appeared on the menu system and allows you to actually count the number of words in the entire document that is currently open.
In order to do this, the new code that was induced by cosmic radiation called into the existing code block that wasn't moved at just the right points to display a new window that displays how many words this current document has.
Of course, in order to provide this new feature, the new code had to know exactly where to call into the existing code in dozens or perhaps hundreds of places in order to accomplish such seemingly mundane things as displaying a new window, placing OK, and Cancel buttons in the just right position on the window, and performing the continuous addition needed as it carefully parsed each word and kept track of the accumulating result.
Of course, to know the difference between one word and another, it had to know what constituted a word ending, like a space or long-dash. It also has to know where the in-memory representation of the code existed which required that it know exactly where the existing Word code stored the vector to this in-memory image.
Furthermore, the new code knew how to make a window disappear and happened to attach this code to the OK and Cancel buttons. It also knew exactly how to call into the Windows internal system—called the Window's API—to facilitate the moving of the window that displayed the word count in the case that the user dragged the mouse on the title bar.
This amazing new code called into the Windows API through a mechanism that programmers call a "message pump" which process "mouse move" messages and reports them back to Windows through a series of documented API calls.
Amazingly, when the code that was written by this cosmic radiation displays the word count, the new code knew exactly where to jump to allow Word to continue working without a single General Protection Fault.
This entire series of coincidences happened in just a few billion years.
Now isn't that just amazing?
Oh, no. I'm sorry. I just realized that the word count feature already existed in Microsoft Word and was developed by a team of highly-trained programmers with extensive experience in C, COM, the Windows API, and also had special knowledge of the inner workings of the Word object hierarchy and each of the objects associated Common Object Model interfaces. And all this in just a few weeks.
How weird is that?
|
|
|
|
|