ExposureAndEncapsulation

^z 27th March 2023 at 5:51am

A body can defend itself against infection in two ways: take on the germs directly and develop an immunity to them; or build barriers against them, confine them when they break through, and otherwise prevent them from causing harm. Real bodies do both.

Software engineering similarly applies the same two strategies for dealing with complexity. A program can reveal internal routines to the outside world and, through documented interfaces, invite users to customize and extend the system to handle new tasks. A program can alternatively isolate internal functions and make it impossible to tinker with or modify them during normal operation. Real programs do both, to varying degrees under varying circumstances and depending on design philosophy.

Scientific hypotheses similarly use the same two techniques. A good theory exposes itself to refutation in a myriad ways. The more experimental tests that it passes and the more predictions that it makes which are verified by observation, then the stronger conviction we have that the theory is an accurate description of Nature. At the same time, good theories encapsulate information and put it into a "you don't need to worry about these details" box — thereby simplifying, making precise yet compact explanations possible. We don't have to look at the detailed motions of subatomic particles to analyze a gas (in equilibrium, far from critical points in phase space, etc.); we don't have to know the detailed compositions of the planets to understand their motions around the Sun (when internal tidal forces are negligible, etc.); we don't have to worry about the state of mind of a person in order to treat an infection (though an optimistic attitude often helps recovery). Exposure and encapsulation: good theories do both.

Friday, January 07, 2000 at 05:54:28 (EST) = 2000-01-07

TopicProgramming - TopicScience


(correlates: GoForBaroque, DangerousGame, BossJobs, ...)