In programming lingo, communication by side-effects is when two procedures communicate via side-effects. In other words instead of doing:

procedure1(a,b)
procedure2(b,c)

to get c you do this:

procedure1(a)
procedure2(c)

Hey, where'd b go? That's what everyone who reads your code will say. It is in there, but instead of being an argument, it is now a global variable that is changed as a side-effect of procedure1. So? So, no one can read your code for one, and for another, you make you code less reusable since procedure2 mysteriously depends on the state of some variable(s) that are not arguments (where most people look first), and may or may not be initialized and/or allocated properly except when procedure1 works its magic.

If you see code like this, you have two choices. Make a new procedure that does 1 then 2 and takes proper arguments, or modify 1 and 2 to communicate via arguments like normal people. Which you want to do depends on whether or not you ever want to do 1 without doing 2 or not.

Log in or register to write something here or to contact authors.