Toward Naturalistic Programming
Total Page:16
File Type:pdf, Size:1020Kb
Beyond AOP: Toward Naturalistic Programming Cristina Videira Lopes, Paul Dourish David H. Lorenz, Karl Lieberherr School of Information and Computer Science College of Computer and Information Science University of California, Irvine Northeastern University Irvine, CA 92697 Boston, MA 02115 +1-949-824-1525/8127 +1-617-373-2076/2077 {lopes, jpd} @ ics.uci.edu {lorenz, lieber} @ ccs.neu.edu ABSTRACT Software understanding for documentation, maintenance or 1. INTRODUCTION evolution is one of the longest-standing problems in Software systems in fields such as Science, Engineering and Computer Science. The use of “high-level” programming Business are naturally complex, in that the structures and paradigms and object-oriented languages helps, but processes that they capture have a certain level of domain- fundamentally remains far from solving the problem. Most specific complexity requiring domain expertise. But, on top of programming languages and systems have fallen prey to the that natural complexity, the problem of software development assumption that they are supposed to capture idealized models is worsened by the existing software development of computation inspired by deceptively simple metaphors technologies. The kernel of the problem is that the existing such as objects and mathematical functions. Aspect-oriented description mechanisms – programming languages – are programming languages have made a significant breakthrough inadequate when it comes to conveying relevant information by noticing that, in many situations, humans think and to people about the software systems. The established describe in crosscutting terms. In this paper we suggest that programming paradigms fail in providing appropriate support the next breakthrough would require looking even closer to for non-hierarchical concerns, additional or custom-made the way humans have been thinking and describing complex behavior, and non-trivial domain-specific structures and systems for thousand of years using natural languages. While processes. As a result, software systems become fragile natural languages themselves are not appropriate for “monuments” of code that only illuminated software programming, they contain a number of elements that make “artisans” (i.e. projects leads) dare to modify, preventing the descriptions concise, effective and understandable. In real domain experts to control the software in a direct and particular, natural languages referentiality is a key factor in systematic manner. supporting powerful program organizations that can be easier The use of architectural descriptions, rigorous software understood by humans. development practices and modern programming languages and tools helps, but fundamentally remains far from solving Categories and Subject Descriptors the problem. The kernel of the problem is the lack of support for program understanding by the different people involved in D.3.3 [Programming Languages]: Language Constructs and the project. Multithreading, exceptional cases, optimizations, Features – control structures. and the like, contribute to the natural complexity of the D.3.2 [Programming Languages]: Language Classifications – programs. But a considerable part of the complexity is due to Very high-level languages. the fact that programmers, when writing the code, are forced by the programming language to write it down in arcane and esoteric ways that are a long way from expressing the natural General Terms intentions behind the code. As a consequence, many times Documentation, Design, Human Factors, Languages. programmers prefer to write blocks of code from scratch rather than having to understand and debug other people’s code. Keywords Especially when working at the systems level, code that communicates effectively to the machine rarely communicates Language Design, Aspect-Oriented Programming, Natural effectively to human readers. Language, Cognitive Foundations of Programming. 1.1 Programming Reflects Thinking Researchers are constantly looking for ways to express the programs in a form that more closely follows the way programmers think before they are forced to break their thoughts in operational details imposed by the existing programming languages. We know that this is possible, because when programmers are asked to explain their code, Copyright is held by the author/owner(s). they do so concisely, skipping operational details, sometimes OOPSLA’03, October 26–30, 2003, Anaheim, California, USA. ACM 1-58113-751-6/03/0010. using a thought flow that is quite different from the control flow in the code. Our goal is to address the gap between those two forms of explanation. Over the years, several languages, both textual and visual, overriding concern with binding and transformation.) Existing have been designed that focus specifically on issues of programming languages force programmers to express ideas usability and expressiveness (e.g., [60] and [10]). They usually using a narrow support for structural and reflective referencing target children, the novice programmer, end-user programming and a total lack of support for temporal referencing. and rapid prototyping. None of these languages, however, has had much success in systems software development. The 1.3 Contribution problem is that those languages and environments present The main purpose of this paper is to re-generate some simplified models of computation that cannot support the discussion around the role of Natural Languages in demands of systems programming. Programming Language design. We are aware that this is a In the domain of professional programming, Object-Oriented relatively old theme that can be traced to the 1960’s [55]. A lot Programming and Aspect-Oriented Programming (AOP) [20] has happened in Linguistics and in Programming Languages have been addressing some related issues within existing since then. In particular, some lessons learned from Aspect- programming languages, targeting complex software Oriented Programming lead us to believe that there is value in applications. In particular, AspectJ [1], an AOP extension to revisiting the issue now. AOP made us pay more attention to Java, allows programmers to localize crosscutting concerns the way certain referencing mechanisms occurring in natural such as tracing, logging or profiling in program modules of languages allow us to express some ideas that can’t be easily their own and outside the classes. That way, code that reflects expressed in traditional programming languages. some important design units, but that Java forces to be spread In this paper we suggest two new ways of thinking beyond throughout the system, can be encapsulated in their own AOP, the first one within the AOP framework, and the second modules, improving readability, maintainability and outside that framework. We make the argument that the configurability. The success of AspectJ is due, in part, to the primitive abstractions in programming languages should be acknowledgement in the software industry that the problems drawn from the study of Natural Languages, rather than from of programming language expressiveness are serious; AspectJ Computer Engineering or Mathematics or ad-hoc metaphors embodies an approach which makes code more expressive, such as Objects. more readable, and more reliable, and can address industry’s need for improved reliability and decreased development time. The reminder of the paper is organized as follows. In Section 2 AspectJ achieves this by making programs follow more we revisit AOP, highlighting the English-equivalents of the closely the intentions of their developers. But even AspectJ is expression mechanisms in some AOP languages. In Section 3 still far from supporting the natural expression forms we are we state some improvements that can be done in AOP systems, looking for. while remaining centered in the AOP paradigm. Section 4 builds on the observations in previous sections and drafts a 1.2 The Role of Natural Languages programming language way beyond AOP. Section 5 describes Before computers came along, people were successfully the relevant fields of research that should be taken into defining and disseminating complex systems for thousands of consideration. Finally, Section 6 concludes the paper in a years, using a technology they come equipped with: natural rather inconclusive manner. language. They were writing all sorts of documents containing structure and process information, ranging from specification 2. ASPECT-ORIENTED PROGRAMMING manuals of complex systems to constitutions of social Understanding the leap between object-oriented modular organizations. Writing a structured document, for example, the programming and aspect-oriented crosscutting programming Constitution of the State of California, requires much more is crucial to contemplate a leap beyond AOP. We have been than simply putting words together in grammatically correct deeply involved in the development of Aspect-Oriented sentences; it requires dividing the subject matter into smaller Programming [20] and several flavors of it, D ([34], [35], [36]), and smaller units, e.g., chapters, sections, subsections, AspectJ ([37], [21]), Demeter [32] and Aspectual paragraphs, sentences, that convey semantic information to the Collaborations [31]. AspectJ, now reaching the 1.0 version, is reader. Those small units don’t exist in isolation; they refer to a stable extension to Java used by large numbers of software and use each other. They do so in ways that obey the rules of engineers in industry. the natural language and