icon to open the header menu

Aesthetics and cognition

The way that things are presented formally has been empirically shown to affect the comprehension of content. Without engaging too directly in the media-determination thesis, which states that what one can say is determined by the medium through which they say it, be it language or technical media ( Postman, 1985) , we nonetheless do start from the point that form influences the perception of content.
Jack Goody and Walter Ong have shown in their anthropological studies that the primary means of communication of the surveyed communities does affect the engagement of said communities with concepts such as ownership, history and governance ( Ong, 2012 Goody, 1986) . More recently, Edward Tufte and his work on data visualization have furthered this line of research by focusing on the translation of similar data from textual medium to graphic medium ( Tufte, 2001) . Several cases have thus been made for the impact of appearance towards structure, both in source code and elsewhere. Here, we intend to generalize this comparative approach between several mediums, by looking at how source code performs expressively as a language of art, stemming from Nelson Goodman's theorization of such a languages.

Source code as a language of art

Moving away from the question of the nature of the aesthetic experience from the perspective of the audience, whether as an aesthetic emotion being felt or as an aesthetic judgment being given, we shift our attention to the object of aesthetic experience, and to the questions of how does a program text represent? and what does a program text represent? . To answer these, we rely on the approaches provided by Nelson Goodman in the Languages of Art: An Approach to a Theory of Symbols  ( Goodman, 1976) .
The starting point for Goodman's analysis is that production and understanding in the arts involve human activities that, though they differ in specific ways among themselves and from other activities, are nevertheless generically related to perception, scientific inquiry, and other cognitive activities, since both artistic and scientific activities involve symbolic systems. It is those two components that Goodman aims at expliciting: what constitutes an aesthetic symbol system, and how does such a system express?
Goodman develops a systematic approach to symbols in art, freed from any media-specificity (e.g. f from clocks to counters, from diagrams to maps models, from musical scores to painters' sketches and linguistic scripts). A symbolic system, in his definition, consists of characters, along with rules to govern their combination with other characters, itself correlated with a field of reference. These symbols and their arrangement within a work of art supports an aesthetic experience102 and, since they are syntactic system which operate at the semantic level, they can be rigorous communicative systems.
A symbol system is based on requirements which might indicate that the work created in such a system would be able to elicit an aesthetic experience103 . Such a system should be composed of signs which are syntactically and semantically disjointed, syntactically replete and semantically dense ( Goodman, 1976) . This classification makes it possible to compare the way various symbolization systems used in art and sience express concepts. In our case, this provides us for a framework to investigate the extent to which source code qualifies as a language of art.
Source code is written in a formal linguistic system called a programming language. Such a linguistic system is digital in nature, and therefore satisfies at least the two requirements of syntactic disjointedness (no mark can be mistaken for another) and differentiation (a mark only ever corresponds to that symbol). Indeed, this is due to the fact that these requirements are fulfilled by any numerical or alphabetical system, as programming languages are systems in which alphabetical characters are ultimately translated into numbers. While not as syntactically dense as music or paint, it is nonetheless unambiguous.
Third, the requirement of syntactic repleteness demands that relatively fewer factors need to be taken into account during the interpretative process104 . On one hand, we can consider that any additional aspects of the source code (such as the display font or the syntax highlighting discussed in  Tools as a cognitive extension   ) are ultimate irrelevant to the computer, thus making it a poorly replete symbol sytem. On the other hand, the importance of such factors, along with abilities to write a program with the same function but with different syntax, pleads for a relatively replete syntactical system. The tendency of program text to veer towards verbosity indeed implies this desirable state of repleteness: more subtleties and intermediate syntax can be added within any proposition, always implying the possibility of clarifying, or obfuscating—both being, as we have seen, different kinds of aesthetic experiences.
Finally, semantic density refers to whether or not there is a limit to the amount of concepts that the symbol system can refer to. As we have shown in    , the affordances that programming languages provide to represent phenomena and concepts from the problem domain fulfill this requirement. While we have been previously concerned with syntax, this ability of programming languages to refer to a problem domain which has not yet shown its limitations at the semantic level is one which gives it representational power beyond strict computational concepts.
As Goodman notes, the distinct signs that compose a symbols system do not have intrinsic properties, but a mark serves as a sign only in relation to a symbol system, and to a field of reference. The field of reference is understood here as being the set of concepts which are being referred to by a symbolic system. For instance, a symbolic system such as western classical music can refer to concepts such as lament, piety, heroism or grace, while a chinese shanshui painting has a landscape composed of mountains and rivers, as well as concepts of harmony, complementarity, presence and absence, as its field of reference. The combination of both the problem domain, as evoked in  Modelling complexity   , and of the technological environment on which the source code is to be executed, developed in  Styles and idioms in programming   , are posited here as an equivalent to the Goodman's field of reference.
It thus seems like source code satisfies to a large extent the critieria to be a language of art, meaning that it exhibits some of the properties which tend to elicit an aesthetic feeling. Most notably, it does not possess a very dense syntax, nor can it be considered replete both from the perspective of the computer and of the human105 , but it nonetheless refers possesses a certain amount of semantic density. Its ability to connect to a particular field of reference, such as hardware, mathematics, or the world at large is another aspect of being a language of art, and is an important part of how programming languages can communicate concepts.
Goodman highlights the ways in which symbols systems communicate, through the notion of reference . To refer to, in this sense, is the action by which a symbol stands in for an item or an idea. Reference, he sketches out, takes place through the different dyads of denotation and exemplification, description and representation, possession and expression ( Goodman, 1976) . We will see how these various means of referring can be instantiated in the symbolic system of source code.
Denotation is the core of representation, a reference from a symbol to one or many objects it applies to and is independent of resemblance. To refer, it uses a particular relationship via the use of labels, in which a symbol stands in for an item in the field of reference. For instance, a name denotes its bearer and a predicate each object in its extension. Names such as variable names or function names thus denote a particular item in the field of reference, and act as their label. For instance, var auth_level  denotes an ability to access and modify resources; the first token var  is chosen by the language designer, while the second token auth_level  is chosen by the programmer.
The labelling process therefore serves as the symbolic expression for a particular field. In source code, this can happen through variable naming, but also through type definition106 , as well as additional affordances which we look at in  Cognitive aesthetics in program texts   , such as the layering of semantic references and the establishment of habitable cognitive structures.
Source code also make extensive use of description. If we consider a program text as a series of steps, a series of states, or a series of instructions, then it follows that source code is explicitly describing the algorithm used—the how of the program, rather than the why. Indeed, a program text is a description of how to solve a problem from the computer's perspective, written extensively in machine language107 . All source code can therefore be said to be a description of a combination of states (data) and actions (functionality).
States are also a particular case in source code: they are both a description and, because they are not the thing itself, they are also a representation. As one can see in    , an individual can be represented within source code with a particular construct in which states and actions are encapsulated. Interestingly, this representation of a concept as an object in soure code does not imply that it reveals the intrinsic properties of the object; rather, these properties appear as they are given by the modelling process of source code syntax. As a symbol system, source code thus proposes a model of the world in which objects have properties; a slightly different representation is therefore always possible.
representation

class Person {
    int age;
    String name;
    Interest[] interests;

    void greet(){
        System.out.println("hi, my name is "+name+"!")
    }
}

class Interest {
    int priority;
    String name;
}

- An example, written in Java, of how source code can be both a representation oif an individual, as well as exemplify encapsulation.
This representation, in the specific instance of object-oriented programming in    , also manifests Goodman's aesthetic symptom of possession. Here, the source code posseses similar properties as the thing referenced (since our prototypal image of a person has an age, a name and interests). Through this possession of a property, it acts as an example of a prototypal person.
Exemplification is another aspect of Goodman's theory, which has nonetheless remained somewhat limited ( Elgin, 2011) . A symbol exemplifying, also called an examplar, is considered as a stand-in for an item in the field of reference. We have seen source code act as an example in  Scientists   , where a particular program text is written in order to stand in for a broader concept. For instance, a program text can, at a lower level, exemplify a particular kind of procedure, such as encapsulation (see    ) or nestedness. The program text therefore exemplifies the constitutive element of the linked list108 . However, a similar program text can also be an example of cleanliness, of clarity, or elegance. A program text written by a software developer can be seen as possessing the property of cleanliness (see    in  Simple   ), by virtue of its implementation of syntactic and semantic rules, while another program text written by a hacker can be seen as highlighting detailed hardware knowledge s(ee    in  Clever   ).
Different implementations of a concept are necessary but not sufficient for aesthetic judgment, whether these different implementations are virtual or actual. The comparative approach is the one which enables the labelling of good or bad only insofar as there is a relative worse or better , respectively. Additionally, the features which a symbol exemplifies always depend on its function (or, more precisely, its functional context) ( Elgin, 1993) . As we show in  Functions of source code   , a symbol can perform a variety of functions: a piece of code in a textbook might exemplify an algorithm, while the same piece of code in production software might be seen as a liability, or denote boredom in a code poem. It is then both the possibility of alternative implementations and the reality of the current implementation context which give the exemplification of program texts its aesthetic potential.
Source code maintains a specific kind of relation to the field of reference. The particular class of characters employed as symbols (called tokens in the context of programming languages), involves a separation between name, value and address, and as such does not guarantee a direct relationship with the items in the field of reference, we can see in the line unsigned three = 1;  of    , where the reference of the name is not the same reference as the value. That is, in program texts, two distinct symbols can be referring to the same concept, value, or place in memory, something Goodman nonetheless assigns as another symptom of the aesthetic: multiple and complex references.
multiple_references

static int verify_reserved_gdb(struct super_block *sb,
                                   ext4_group_t end,
                                   struct buffer_head *primary)
{
    const ext4_fsblk_t blk = primary->b_blocknr;
    unsigned three = 1;
    unsigned five = 5;
    unsigned seven = 7;
    unsigned grp;
    __le32 *p = (__le32 *)primary->b_data;
    int gdbackups = 0;

    while ((grp = ext4_list_backups(sb, &three, &five, &seven)) < end)
    {
        // ....
    }
    return gdbackups;
}


- An example from the Linux kernel showing that the name and the value of a variable might refer to different things. Here, the name of the variables , and actually refers to the power at which the value is considered when scanning the ext4 filesystem. It iterates through the powers of 3, 5 and 7 and the variables , and hold the next power of each to consider for the sequence. They could all start at the zeroth power (1 in all cases), but there is no need to consider 1 three times, so it is enough to let three start at 1 and the others at the 1st power (5 and 7). .  ( Linux, 2023)
On the other hand, the representation of a field of reference is done through a disjointed and differentiated system: the boundaries of each items in the field of reference are clearly defined, in virtue of the specific symbol system that programming languages are. It is their combination which, in turn, enables complex interplay of references.
We have shown here that source code qualifies as a symbolic system susceptible of affording symptoms of the aesthetic. We have also highlighted its specificities, particularly in terms of descriptions and representations through a restricted syntactic system enabling complex and multiple references, due to it being a language across human and machine understanding. Source code is thus written in a specific kind of symbol system, one which counts as a language of art, but does with restricted syntax and expansive semantics.
A final aspect to investigate is the expressiveness of source code, with a particular attention to how source code can manifest of metaphorical exemplification and representation. One particular expressive power of an aesthetic experience surfaces when the examplification involves a foreign element, an event that Goodman refers to as metaphorical exemplification. While this approach has been broadened by Lakoff et. al., and mentioned in  Metaphors in computation   , other philosophers of art have also pinpointed the metaphorical event as a reliable symptom of the aesthetic.
Max Black initiates a view of metaphors which go beyond a simple comparison; dubbed the interaction view , he considers the metaphorical device as containing positive cognitive content, rather than simply entertaining or limiting ( Black, 1955) . Against a traditional view of metaphor being a word which stands in for another, Black reveals a large web of interactions which prove harder to disentangle, beyond usual similarities between two words109 . Simply paraphrasing a metaphor, even if one captures precisely the same connotations/associations as the metaphor, does not convey the same meaning as the metaphor itself. For instance, saying " Je chavire dans l'embrun des phénomènes "110  ( Beckett, 1982) does not have the similar expressive power as listing all the properties of phénomènes . The use of the verb capsize in conjunction with spray relates to the domain of navigation, while capsize alone tends more to a dynamic movement, and spray to uncertainty and bluriness of shape. Phenomenas of the world are all requalified in the light of these new kinetic and perceptual associations.
Through his contribution to aesthetic philosophy, Monroe Beardsley's started touching upon metaphor from a semantic perspective. Published alongside his inquiries into the aesthetic character of an experience, The Metaphorical Twist implies that semantics and aesthetics might be connected through the structuring operation of the metaphor—that which elicits an aesthetic experience can do so through the creation of unexpected, or previously unattainable meaning. Beardsley's conception is that metaphor can have a designative role (the primary subject) which adds a " local texture of irrelevance ", a " foreign component ", whose semantic richness might over-reach and obfuscate the intended meaning, as well as a connotative one (the secondary subject), in which meaning is peripheral ( Beardsley, 1962) . The cognitive stimulation and enlightment takes place through a metaphor-induced tension, between central and periphery, between illuminating and obfuscating, between evidence and irrelevance.
As Beardsley inquiries into the features necessary for an aesthetic experience, of which the metaphor is part, he lists five criteria to distinguish the character of such an experience. Besides object-directedness, felt-freedom, detached-affect and wholeness, is the criteria of active discovery , which is
a sense of actively exercising the constructive powers of the mind, of being challenged by a variety of potentially conflicting stimuli to try and make them cohere; exhilaration in seeing connections between percepts and meanings; a sense of intelligibility ( Beardsley, 1970) .
As such, Beardsley highlights the possibility of an aesthetic experience to make understandable, to unlock new knowledge in the beholder, and he considers metaphors as a way to do so. The stages he lists go from (1) the word exhibiting properties, to (2) those properties being made into meaning, and finally into (3) a staple of the object, consolidating into (or dying from becoming) a commonplace. This interplay of a metaphor being integrated into our everyday mental structures, of poetry bringing forth into the thinkable, and in the creation of a tension for such bringing-forth to happen, makes the case for at least one of the consequences of an aesthetic experience, and therefore one of its functions: making sense of the complex concepts of world.
Finally, Catherine Elgin has pursued the work of Goodman by furthering the inquiry into arts as a branch of epistemology. Drawing on the work mentioned above, she investigates the relationship between art and understanding, considering how interpretively indeterminate symbols advance understanding ( Elgin, 2020) , and that it does so in the context of interpretive indeterminacy. As syntactically and semantically dense symbol systems are used in artworks, it is this multiplicity in interpretations which requires sustained cognitive attention with the artwork. To explain these multiple interpretations, the metaphor is again presented the key device in explaining the epistemic potency of aesthetics, based on an interpretative feedback loop from the viewer. And yet, in the context of source code, this interpretation is always shadowed by its machine counterpart—how the computer interprets the program.

Contemporary approaches to art and cognition

We have drawn from existing work in philosophy of art, in order to map out the expressive power of a given formal representation, as a traditional pre-requisite to the gaining of art status of an object, and highlighted the role of metaphors in engaged cognition during an aesthetic experience. Contemporary literature, and the emergence of neuroscientific studies of such aesthetic experience seem to confirm empirically this approach, and highlight as well two related additional components: sequential experience and skill levels.
The aesthetic experience—that is, the positively received perception of a natural or crafted object—has traditionally been laid out across multiple axes, with more or less overlap. The axes involved in this positive perception include an emotional response, a harmonious assessment, an axiomatic adherence or disinterested pleasure, and have been the topic of debates amongst philosophers for centuries ( Peacocke, 2023) .
Noël Carroll sums up these different directions under the broad areas of affect, axiom and content ultimately considering a content-based approach as the most fruitful ( Carroll, 2002) . First, he underlines how an aesthetic experience dictated by affect removes the object from one's assessment of purpose, value and effect, and limiting it to form, following Kant's principle of disinterested pleasure via passive contemplation. As such, a flower, a sunset or a musical melody can evoke affective aesthetic experiences. Yet, the supposed tendency of this kind of experience to release us from worldly concerns fails, for Carroll, to encompass aesthetic experiences that are rooted in so-called worldly concerns—such as a documentary photography, skillful physical performance, or delicatedly crafted glassware—and is therefore unsatisfying as a root explanation for the aesthetic experience.
An axiomatic aesthetic experience is based on the sort of value that the object is being associated with—such as depiction of religious topics or a manifestation of a particular style. While Carroll does acknowledge a certain virtue of this aesthetic experience in terms of contribution to group cohesion through shared values and imaginaries, its limitations are found in a pre-existing answer to the value judgment that is being bestowed upon the object: the material and sensual properties of the object at hand are irrelevant since their quality is already decided a priori .
It is in the content approach that Carroll finds the most satisfying answer to what the aesthetic experience is. Content, here, is defined as the significant forms being apprehended, along with its combinations, juxtapositions and comparisons with other forms111 . When we engage with the sensual aspects or an object, our attention is indeed directed first and foremost at what the object looks like, rather than how it makes one feel, or what value system it belongs to. More specifically, Carroll notes, if attention is directed with understanding to the form of the art work or to its expressive and aesthetic properties or to the interaction between those features, then the experience is said to be aesthetic ( Carroll, 2002) .
Form, and the attention paid to it, will thus be taken as our starting point. This content approach to form, i.e. the set of appearing choices intended to realize the purpose of the artwork, also involves questions of function, implied by the presence of purpose pertaining to an artwork. Particulary, how does the object of aesthetic experience manifest such a purpose, in a way that it can be correctly judged, insofar as its perceived form and perceived purpose are aligned, distinct from any emotional or axiomatic charge?
We can find an answer in the study conducted by Anjan Chatterjee and Oshin Vartanian on the evaluation of the aesthetic experience from a neuroscientific point of view. Like Carroll, they highlight three different perspectives: a sensory-motor perspective, loosely mapped to an affective experience, an emotion-valuation perspective, similar to an axiological experience, and a meaning-knowledge experience, which we equate to the content approach to the aesthetic experience ( Chatterjee, 2016) .
Importantly, they make the distinction between an aesthetic judgment, which emanates from the process of understanding the work, and an aesthetic emotion, which follows from the ease of acquisition of such an understanding. Without being mutually exclusive, these two pendants are related to the amount of engagement provided by the person who aesthetically experiences the object. One can have an aesthetic emotion without being able to provide an aesthetic judgment, a case in which one does not hold enough expertise to apprehend or appreciate a particular realisation. In this sense, the aesthetic judgment, unlike the aesthetic emotion, requires something additional. This conditioning of the aesthetic experience to a certain kind of pre-existing knowledge or skill is supported by the authors' mention of the theory of fluency-based aesthetics ( Chatterjee, 2016) . This view implies that pre-existing knowledge or skill also involves models which frame aesthetic experiences as the products of sequential and distinct information-processing stages, each of which isolates and analyzes a specific component of a stimulus (e.g., artwork).
These stages, drawn from Leder et. al's model, are based on empirical observation in scientific studies which segment an aesthetic experience in sequential steps ( Leder, 2004) . These evolve form perception, to implicit classification, explicit classification, cognitive mastering and fianlly evaluation—that is, fully-qualified aesthetic judgment. This conception is concomittant to Rebert et. al.'s proposal for an aesthetic framework based on processing fluency, which they define as a function of the perceiver's processing dynamics: the more fluently the perceiver can process an object, the more positive is her aesthetic response ( Reber, 2004) . While they focus their study on perceptual fluency, tending to traditional aesthetic features such as symmetry, contrast and balance; they also consider conceptual fluency as an influence on the aesthetic experience, through the attention given to the meaning of a stimulus and the relation of form to semantic knowledge structures. Such a conceptualizing thus hints at a similar skill-based, contextual framework which we have seen emerge in the aesthetic judgment of source code, and yet an additional establishment of a relation between truth and beauty112 .
This approach of cognitive ease, which we have already identified in the conclusion of  Aesthetic ideals in programming practices   , is finally echoed in the view that Gregory Chaitin, a computer scientist and mathematician, offers of comprehension as compression. By considering that the understanding of a topic is correlated with the lower cognitive burden experienced when reasoning about such topic, Chaitin forms a view in which an individual understands better through a properly tuned model—a model that can explain more with less ( Zenil, 2021) . In this sense, aesthetics help compress concepts, which in turn allows someone told hold more of these concepts in short-term memory, and grasp a fuller picture, so to speak.
These studies thus show a particular empirical attention to the cognitive engagement with respect to the apprehension an object from an aesthetic perspective, as opposed to passive contemplation or value-driven aggreement. While these other types of experiences remain valid when apprehending such an object, we do focus here on this specific kind of experience: the cognitive approach to the aesthetic experience. Going back to Goodman, he describes such an experience as involving:
making delicated discriminations and discerning subtle relationships, identifying symbol systems and what these characters denote and exemplify, interpreting works and reorganizing the world in terms of works of art and works in terms of the world. ( Goodman, 1976)
-
In this section we've glanced at an overview of research on how cognitive engagement is involved in an aesthetic experience, both from the point of view of the philosophy of art and from cognitive psychology. However, highlighting this involvment does not immediately explicit the nature and details of such cognitive engagement. Speaking in terms of form and object are higher-level concepts tend to erase the specificities of the various systems of aesthetic properties, and how their arrangement expresses various concepts.
Now that we have sketched out an understanding of source code as a symbolic system supporting an aesthetic experience, we must provide a more detailed account of the specificities of source code. To do so, we first turn to a comparative approach, looking at the set of aesthetic domains metaphorically connected to source code through programmer discourse, and we analyse how each of these domains involve cognition in their formal presentations.
icon to download the pdf of the thesis