Large finite subsets of characteristic zero fields which form combinatorially extreme configurations with respect to solutions to polynomial equations often appear "linear". One example of this is the Szemeredi-Trotter phenomenon, where exceeding a certain bound on the number of incidences in an algebraic incidence system forces the configuration to be somewhat degenerate. Another is the Elekes-Szabo theorem which shows that an (abelian) algebraic group must explain extremal properly ternary relations. Elaborating on work of Hrushovski, we discuss a formalism in which these phenomena become instances of modularity of an associated geometry; this is a precise notion of "linearity" with strong consequences, yielding in particular higher arity versions of Elekes-Szabo. This is part of a project with Emmanuel Breuillard.