The 'FizzBuzz' Programming Test: A Case Based Exploration of Rhetorical Style in Code
While software developers have long discussed concerns of style in regards to writing code, scholars of computation would benefit from a rhetorical approach to style, an approach that links style to substance and sees style as situated and audience specific. However, every code text is informed by stylistic decisions that impact how the text is interpreted and understood. In this essay, several stylistic variations of code written for the 'FizzBuzz' hiring test are examined in order to demonstrate the significance of stylistic choice in code composition. The range of approaches coders might take to communicate a preferred method of accomplishing a given task in code indicates that rhetorical style performs an important role in how code is accessed and comprehended by human and nonhuman audiences alike. Accordingly, software critics need to attend more closely to the ways that coders employ style in order to induce particular types of rhetorical action through their code texts and practices. Rhetorical Style in Code 3 Introduction For the last several decades, rhetoric has increasingly been understood to play a significant role in communication occurring not just in discursive speech and writing acts but across numerous modes of meaning making, including image, color, gesture, spatial arrangement, aurality, and procedure. For rhetoricians, recognizing that meaning is created and communicated across these modes serves as a beginning point to understand how each of these modes, and the media through which they are communicated, affords particular approaches to constructing and representing persuasive arguments for various audiences. This question is commonly understood to be one focused squarely on style. Rhetorical style is often described as an ornamentation or clarification of substantive argument, those ideas initially developed through invention.[1. Aristotle, On Rhetoric: A Theory of Civic Discourse, trans. George Kennedy (Oxford: Oxford UP, 1991) III.ii.1 3. However, style serves a greater purpose as the articulation and performance of the values underlying one's argument. As Barry Brummett argues, 'Style is a complex system of actions, objects, and behaviors that is used to form messages that announce who we are, who we want to be, and who we want to be considered akin to.[2. Barry Brummett, A Rhetoric of Style (Carbondale: Southern Illinois UP, 2008) xi. Similarly, Chris Holcomb and M. Jimmie Killingsworth argue that stylistic variants result in messages that may appear similar but suggest distinct ways of understanding a given argument and the world it constructs.[3. Chris Holcomb and M. Jimmie Killingsworth, Performing Prose: The Study and Practice of Style in Composition (Carbondale: Southern Illinois UP, 2010) 3 4. Rhetoricians since antiquity have often suggested that among style's greatest strengths relates to disguising one's stylistic decisions in order to pursue more Rhetorical Style in Code 4 effectively one's goals: 'authors should compose without being noticed and should speak not artificially but naturally Concealing stylistic decisions] is well done if one composes by choosing words from ordinary language.[4. Aristotle, On Rhetoric, III.ii.4. While calling attention to, or avoiding calling attention to, one's stylistic decisions can work in favor of some ends compared to others, style does not have to promote an agonistic or deceptive relationship between rhetor and audience. Style, described more inclusively, is how we attempt to construct effectively the artistic presentation of an argument in order to achieve a particular end. Style as a term used among computer programmers is conventionally either (1) addressed as a set of universally applicable qualities (e.g. conciseness, readability/clarity, lack of repetition) that may not necessarily reflect the interests or values of specific communities or (2) ignored altogether as a relevant concept in discussions about 'best' or preferred programming practices. This is not to suggest that style is omitted from decision making about how to write code only that such decisions are not always made consciously or explicitly by developers communicating with one another through code. Here is where a rhetorical approach to style is useful: it provides a framework for understanding style as situated in particular communities, wielded toward particular ends, and crafted for particular audiences. In this essay, I explore how rhetorical style relates to software development in order to demonstrate that writing code is a rhetorical practice of meaning making and worthy of note as such. Just as Matthew Fuller has argued that, [b]ecause free and open source software opens up the process of writing software in certain ways its [sic] also opens up the process of talking and thinking about it,[5. Matthew Fuller, 'Introduction, the Stuff of Software, in Software Studies A Lexicon, ed. Matthew Fuller (Cambridge, MA: MIT Press, 2008) 7. so too should we investigate how processes of writing software suggest certain ways of talking about and thinking Rhetorical Style in Code 5 about communicating through those acts of writing software code. For software studies scholars, attending to rhetoric's understanding of style is particularly significant because it helps us understand how persuasive decisions have potentially major impacts on how algorithms are imagined, programs are created, and social events are impacted through the use thereof. As noted by rhetorician Kenneth Burke, [w]herever there is persuasion, there is rhetoric. And wherever there is "meaning," there is "persuasion."[6. Kenneth Burke, A Rhetoric of Motives (Berkeley: U of California Press, 1969) 172. My own exploration of rhetorical meaning will occur through the examination of how code developers write, and audiences make use of and respond to, stylistic decisions relating to the construction of procedure, syntax, and arrangement of ideas. As a relevant situation for identifying and illuminating style preferences as they work toward certain rhetorical ends, I will analyze examples of code written to complete the FizzBuzz test, a small scale hiring test to examine programming applicants' basic knowledge both of code languages and of procedural and iterative operations. Despite its small size (in most iterations of texts written for the test) FizzBuzz serves as a relatively accessible synecdoche for programming as an activity and code as a text; the approaches taken to solve the test and the myriad, often passionate discussions surrounding any individual solution to the test can help us see more clearly how code and rhetoric are more closely intertwined than may often be recognized. Style and Its Role in Rhetorical Activity Among software developers, style is commonly understood as serving a seemingly universal and instrumental end, often framed in ways that suggest particular ideologies of 'best' or 'elegant' or 'acceptable' practice within an industrial frame. For example, Brian W. Kernighan Rhetorical Style in Code 6 and P.J. Plauger generalize the shared values of human audiences of code when, in the preface to the first edition of their Elements of Programming Style, they state, 'The principles of style, however, are applicable in all languages, including assembly codes. [sic][7. Brian W. Kernighan and P.J. Plauger, The Elements of Programming Style, 2 ed. (New York: McGraw Hill, 1978) xi. The issue under debate is what 'style' in this case, the implied 'good' style of readable code means to diverse bodies of programmers and programming communities whose preferences for how code works, and how it reads to the community members making use of it (e.g. building on existing code, rewriting existing code, or contributing new code) Kernighan and Rob Pike begin moving toward a clarification of these nuances when they note, [W]hy worry about style? Who cares what a program looks like if it works? W]ellwritten code is easier to read and to understand, almost surely has fewer errors, and is likely to be smaller than code that has been carelessly tossed together and never polished. Sloppy code is bad code not just awkward and hard to read, but often broken.[8. Brian W. Kernighan and Rob Pike, The Practice of Programming (Reading, MA: Addison Wesley, 1999) 28. While still generalizing, Kernighan and Pike make several important observations. First, they respond to questions about style specifically, about distinctions often made between style and logical ability (e.g. a difference between what a computation would do conceptually and how that might be written as a procedure in code) Second, they acknowledge that many view questions of style as unimportant or incidental. Third, they argue that such perspectives ignore the impact that stylistic choices have on the mechanical as well as the readable quality of code one's inability or refusal to write in a way that makes sense to some anticipated human reader may very likely also result in an inability to write in a way that a computer can interpret Rhetorical Style in Code 7 successfully. This integral role of style to anticipated action is crucial for rhetoricians, as style has traditionally been understood as the filter or frame through which ideas are shaped for presentation to an audience. In other words, if rhetorical invention is the what (the discovery and development) of an argument, then, through this lens, style in combination with delivery and arrangement would be considered how that argument is constructed to be presented most successfully for the appropriate audience(s) Unfortunately, for many such a definition has long constrained style as providing only ornament or decoration on a distinct argument, as though the manner of presentation were subordinate to and separate from the content of that argument. Unfortunately, this line of thinking is in line with trends to associate style with a general set of