# Code Locality
[[Software Engineering]] [[Software Craftsmanship]]
In [[BOOK - Richard Gabriel - Patterns of Software]], [[Richard Gabriel]] refers to code locality as being able to understand code by its immediate context.
Compressed code (see [[Code Compression and Reuse]]) often refers to external context to achieve that compression.
In my thinking, external context can be in code itself (say, inheritance), in which case code would have poor locality, But external context can also be a shared understanding of theory and design patterns amongst the team. Because such external knowledge is internalized by the programmer itself, and is not "factual knowledge", code locality is actually high.
For a developer who doesn't share the external theoretical context, code locality is very low, because the context can't be inferred and looked up in the code itself.
For example, the inverse square root of the determinant that Ben used to replace the scaling factor for the galvos when I joined Formlabs required many hours of reading up on geometry and [[Linear Algebra]] to figure out.