Tuesday, April 08, 2008

SofSW: The SW Basics (5/6)

So if the mass of a program measures its external observable effects, we can make some conclusions. If we take a program with a set of features and functionality with a mass m0 and divide it into two pieces, we’ll get two programs. It’s like cutting a worm in two. Because worms have no brains, or central nervous system, they can function without their “heads”. As a matter of fact, worms don’t have heads, they have the input hole and the output hole around which the worm forms a kind of pipe. Some programs are like that too, they have no central point of control. Far from being brainless, such programs are actually very useful. They normally consist of fairly autonomous parts, which you can easily reuse in other programs for similar purposes. Reuse is an extremely valuable property of source code and often much too undervalued for its worth. Software developers want to do everything from scratch like anybody with too large an ego for their head.

Anyway, dividing a program into two parts gives us two sets of source code. If the source code is well enough designed, the two programs even function. The original mass m0 is divided into two masses, m1 and m2. There are now three possible situations: either all the functionality is in m1 or all features are included in m2 or the third possibility that some of the functionality is in m1 and some in m2. Mathematically these three situations are like this:

(1) m1 = m0 AND m2 = 0
(2) m1 = 0 AND m2 = m0
(3) m1 < m0 AND m2 < m0

It is possible to cut such a small piece of software that no feature is affected. It means that the little piece doesn’t do anything either. If the mass of a program is zero, it doesn’t do anything observable. This happens in the first two cases. In the third case both programs have external effects but neither will do everything that the original program does. If we want to combine these three states, we can make our first real conclusion. Conclusions are results we can use later without proving them because we have already done that. Our first conclusion says that the sum of the masses of any two programs is at least zero but at most m0. More specifically,

0 ≤ (m1 + m2) ≤ m0

This has the strange effect that if we put together just any two carelessly crafted programs, instead of getting a total set of features like m0, we might end up as well with a completely non-functional program with zero mass. That’s at least what the formula allows and the thought has some intuitively pleasant qualities. That’s simplistic maybe, but the foundation must be simple in order to have any possibility of understanding the inevitably more complex construction built on it. Another way of thinking about the formula is that when we split a program into two parts, some of the functionality might be lost because of the cut. Therefore the sum of the parts can be smaller than that of the whole.

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home