5 ms·
Legos interact with each other in a very well-defined manner. The circular interlocking portions must be manufactured to a tolerance of 10 micrometers so that t
by syndicatedjelly 3y ago
Legos interact with each other in a very well-defined manner. The circular interlocking portions must be manufactured to a tolerance of 10 micrometers so that the bricks lock as expected, but can be removed easily.
In a good interface (e.g. an API), the parameters passed around can be defined and characterized precisely, perhaps using input validation and strong typing. The designer of an interface should know and handle all the permutations of data in and data out. If a surface-level function can't handle negative values, then the designer must know how the function will respond.
Back to Legos. despite their extraordinarily tight specifications, there is practically nothing that can't be built with Legos, in the precisely-defined Lego universe. Six 2x4 bricks fit together in 915,103,765 ways. It's unlikely any particular design decision by Lego enabled this, but it's almost like they built a Turing-complete construction language.
Similarly, good interfaces shouldn't unreasonably constrain the user.
Finally, and this may be stretching the analogy, Legos interfaces sort of act like a "black box". One can attach a Lego to any interface of an existing Lego project without concern for what color the bricks are, how many bricks are connected, even the types of all the other bricks involved. The interface is all that matters.
Likewise, a good interface doesn't require the user to dig into the source code to understand how to use the surface level connections.
Reference: https://en.wikipedia.org/wiki/Lego https://en.wikipedia.org/wiki/Lego