2005-07-05

一个令人哭笑不得的隐喻

Intentional Software: Is programming a form of encryption?:

"This is very clear when we look at real encryption. If a secret message needs a follow-up, for example a military commander wants to attack target B instead of target A, this will definitely not be implemented by directly editing the encoded message! Instead, the clear text will be edited and the encryption re-run. Why the seeming complication? Again, in case of encryption the answer is obvious, it would be very difficult to find the encoded “image” of A in the result and replace it by the encoded “image” of B. Because the military has a computer that does the encryption, and they also have the key, it is much easier to change the original intention in the clear text from A to B and re-encrypt the whole message, not just B.

Of course this is just a thought (“Gedanken”) experiment because modern encryption techniques are so good that the image of A would be impossible to find.

Still, in programming we are in effect editing the encoded message all the time. When the intention in the problem changes from A to B, the programmers in fact have to replay the whole thought experiment described above:

  1. identify the image of A in the code – effectively all the places where A had an effect on the code. This is called code-scattering in aspect oriented programming.
  2. encode B in terms of the same implementation assumptions that were in force when A and the rest of the code were first coded.
  3. edit the code by removing the image of A and inserting the image of B.

This is true for all the other activities mentioned earlier – for testing, optimizations, or even documentation."

没有评论: