B-threads: programming in a way that allows for easier changes
I feel like Babbage when he said, &quot;On two occasions I have been asked, &#x27;Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?&#x27; I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.&quot;<p>Maybe I&#x27;m missing some key insight, but this process seems like madness to me.<p><i>&gt; Then we wouldn’t have to read and understand where to squeeze our changes. We’d simply add stuff based on the new requirements and things would somehow magically work.</i><p>But, at some point, <i>someone</i> has to understand if those requirements clash with the old ones that are currently implemented. The hot&#x2F;cold water example is, I think, telling. At no point in the article does the author <i>actually state what the requirements (new or old) are.</i> You have some program that, whenever the water level gets low, adds three hot waters. I guess that was some original requirement.<p>Then another b-thread is added that also adds three cold waters. Now whenever the water gets low, twice as much total water is added. Presumably that&#x27;s OK? When the second b-thread was added, was the requirement to fill the container with cold water instead of hot, or was it to fill the container with twice as much lukewarm water?<p>Finally, the third b-thread is added that interacts with the two previous ones to cause the hot and cold water adds to be interleaved. What requirement does that meet? The stated purpose of all of this is that you don&#x27;t need to understand the original program to modify it, but the entire purpose of this third thread is to interact with the previous two. You have to know there are already two b-threads going, which events they listen to, and what they yield in order to create the third thread that blocks them. So I don&#x27;t see how this is any better than needing to read the code in a normal program.<p>I feel like I&#x27;m taking crazy pills.