Smith's Assembler
Rachel Lomasky for AdamSmithWorks
November 4, 2019
Adam Smith opens “The Wealth of Nations” with a description of an eighteenth century pin factory. Rather than each worker in the factory making pins from end-to-end, everyone is responsible for specializing in one or two sub-operations. If each worker were making each by pin himself, he could create 150 pins per day. However, by deconstructing the assembly tasks, a factory of ten men produces 48,000 pins/day. Smith sees the factory as a beautiful example of the division of labor. That’s fine, he’s an economist. I see it as a beautiful example of software design principles, particularly “separation of concerns” and the overarching KISS (Keep it simple, Stupid). That may be because I’m a computer scientist.
Division of labor and good software design share the foundation of modularity: small building blocks composed together to become more than the sum of their parts. Software is divided into components: pieces of independent code that communicate through interfaces. It’s this simplicity that empowers the scalability. Likewise, the pin factory is broken into components: small steps to building a pin. Each step is atomic and self-contained, like a well-designed software module.
Agile
ability to create and respond to change
Agile software is developed by requirements and code evolving through the collaborative efforts of the developers, continuously listening to their users and improving. In the factory, a worker doesn’t need to serially learn all of the eighteen pin-making skills before becoming productive. Thus, the lead time to becoming a productive pin-maker is just the effort to learn one skill. And, likewise, a factory can begin producing product quicker and faster, getting it to market, gathering valuable user feedback, and pivoting the product as needed.
Reusable
use of existing assets in some form
The developers’ mantra is “don’t repeat yourself.” Code should be written in a way that it can be reused as many times as possible, to avoid repeating the planning and work. Likewise, the simple steps of pin-making, e.g. drawing out wire, are applicable to the manufacture of many things or perhaps even reusable within the pin-making process. Thus, a worker could easily move between product lines. In other words, learning how to manufacture pins also lets the worker learn to manufacture many other items, allowing the worker’s effort to dynamically shift to where it is most valuable. It also allows the company to compose larger, more complicated products from assembling atomic worker skills, because it is not limited by the amount of knowledge and skill that one person can command.
Updatable
A change in one component does not necessitate changing another component
Well-designed software is designed so that as requirements drift, the software can easily be maintained with the minimal code change. Similarly, if one pin-making step needs to be updated, only the worker performing it needs retraining. Therefore, the cost of updating the step is optimal. In an end-to-end model, every worker would need to learn the new skill. Also, adding a new step or rearranging the order of the steps does not affect all the workers. The division of labor in the factory allows rapid iteration and innovation, leading to continual improvement and responsiveness to the market.
Testable
Finding faults in the system is easy
Good code has unit tests, where each piece of software is continuously and independently checked to immediately detect defects. Each step can be unit tested in isolation of the other components, ensuring that “bugs” can be quickly tracked down. The concept of unit tests maps nicely onto the pin factory. Each operation’s input and output can be tested separately, as well as integrated into the entire pin-creation pipeline. If quality assurance discovers a step that was executed incorrectly, the manager knows exactly who is responsible for that step and can take corrective action.
Conclusion
The end-to-end pin-making process was essentially hardware: hard-coding the process into a worker, including the order of the operations. It required a large refactoring effort to teach him to make a different type of object. In software design terms, these tasks were rigid, difficult to change because it would involve changing every single worker. In addition to the physical limitations which restricted the number of pins a worker could make in a day, it made it difficult for the factory to be adaptive. Division of labor made the factory into software, easily reconfigurable.
Comments
Shal Marriott
Another similarity perhaps, is the way in which both working at a pin factory and a piece of software require methodology. I once heard it said that 90% of writing code is logic, the other 10% is the language.
Whether that be true or not, it shows how in order to understand how it all works together, you have to understand the way in which it was designed. This seem like it would speak to the pin factory as well.