Scale-free Geometry in Object-Oriented Programs

Object-oriented programs, when executed, produce a complex web of objects that can be thought of as a graph with objects as nodes and references as edges. In recent years interest has grown in the geometry of networks (or graphs), particularly those of human origin, many of which show a rather striking property: their structure is scale-free. In the case of the World Wide Web, for example, the number of web pages with 1 incoming link is about twice the number with 2 incoming links, and that is twice the number with 4 links, and so on all the way up to Google and other massively referenced sites [2]. The phrase ‘scale-free’ relates to the fact that if we double the number of links n, the number of pages is always halved (or other fixed ratio) regardless of what n is. Compare this to what happens if a graph is constructed by simply adding links at random [4]. Doing this leads to nearly all nodes having around the same number of links (i.e. the number of links divided by the number of nodes), and hence such random graphs have a ‘typical scale’ about them. By contrast, the web has no typical scale to its connectivity — a remarkable and somewhat counterintuitive property closely related to fractals. Other scale-free graphs include the network formed by co-authors of papers in medical journals, the physical connections forming the Internet, the network of airports connected by airline flights, networks of sexual contacts, and even the patterns of connectivity between neurons in the human brain [1]. Well before being noticed in real-world graph structures, scale-free distributions were found in other contexts, such as the relative frequencies of English words, the distribution of personal wealth, the sizes of cities, and the number of earthquakes of given strength [12]. In this article we examine the graphs formed by object-oriented programs written in a variety of languages, and show that these turn out to be scale-free networks as well. Apart from its considerable intrinsic interest, this unexpected facet of the geometry of real programs may help us optimize language runtime systems, improve the design of future object-oriented languages, and reexamine modern approaches to software design.