Grocery stores are great abstractions

The purpose of a programming abstraction is to hide complexity. Modules and libraries abstract away complex code; coding languages abstract away complex assembly; assembly abstracts away complex binary operations; binary operations abstract away complex transistor chemistry. A person working at any given layer is, ideally, spared the cognitive load of understanding the complexity of the layers beneath. The quality of an abstraction is measured by how effectively it hides its internal complexity behind a clean interface.

Whenever I'm designing software, my aspiration is to abstract as effectively as a grocery store does. To purchase a carrot at a grocery store, you walk in, grab a carrot from the bin, pay at the register, and walk out. You don't need to think about the top-lifting harvester that pulled that carrot from the ground. You don't need to think about the factory that produced that harvester or the mines that supplied its metal. You don't need to think about the networks of boats, trains, and trucks that brought that carrot from the farm to your city. You don't need to think about the musculoskeletal system of the shelf stocker who was able to dexterously move the carrot from its shipping box to the bin. You don't need to think about the data analysts who, over months of meetings, arrived at the guidelines for how that bin should be placed within the store. You don't need to think about the financial system that trades on carrot futures and how its fluctuations affect farmer incomes. You just buy a carrot.

Carrots

If a grocery store can provide me with a carrot despite all of this inherent complexity, I can, God willing, write some code that doesn't suck.

Comments

Popular Posts