So what is a side-effect? To me a side-effect is a phenomena that happens outside the domain of a computer program. Figure 1 explains this idea.

Figure 1. A basic side-effect within a state-machine transition from state S1 to state S2. The side-effect is "emmited" when the state transition is done.
Figure 1 shows a basic side-effect that is emmited when the state machine transition occur. The computer is not aware that this side-effect is occuring. Why? Because, by definition the side-effect is something that happens outside the domain of the program. An example will clarify the concept.
Example
An embedded microprocessor is connected to a light-emmiting diode (LED named LED2) with a connection shown in Figure 2. The LED2 will turn on, if the output line PD0 is set to one (1). The LED2 will turn off if a value zero (0) is set to the line PD0.

Figure 2. A light-emmitting diode (LED named as LED2) connected to a microprocessor bus signal named as PD0.
Now a code fragment that turns the LED2 on is below.
...
/**
* Turns on LED2
* @return Returns The answer to life and universe and everything.
*/
int turnOnOnlyLED2()
{
int theAnswer = 42; // Thanks Douglas Adams; we know the answer!
PORTD = 0x01;
return theAnswer;
}
...
By looking the code we can observe couple of things about side-effects:
- The computer program can’t differentiate a side-effect cousing action from a normal registry operation like writing to a register x in the shown code fragment.
- The operation of the LED2 is totally and completely isolated from the code fragment. The code does not contain any glue that a surprise of green LED turning on is happening.The operation of the LED2 in physical universe is totally and completely isolated from the code fragment.
- The owner of the embedded system does not talk codish; The owner talks “side-effectish”; or how she wants to see a LED2 turning on. Thus all *requirements* the owner is stating in requirements management systems and Scrum-meetings and where ever are about – you guess now already – The owner is interested in only about side-effects.
So what side-effects are there? Here your list is as good as mine. Here is my short list:
- Any physical phenomena that happens due to a computer operating is a side-effect (both input and output type of side-effects). A side-effect can be a simple like turning on a LED2 or as complex as a complex video game in your game console.
- Time is a side-effect. I will come to this later post.
- Memory is a side-effect based on Time-side-effect working on a place
So now you know something about side-effects. I will try to develop some ideas how a computer program can be generated directly from user side-effect speech without intermediate representations. Hey that sounds impossible to do. Yes – it is.