{'fraction_non_alphanumeric': 0.04452554744525548, 'fraction_numerical': 0.004744525547445255, 'mean_word_length': 4.907327586206897, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Aspect-Oriented Programming in the Design of Computer Algebra Libraries

During the past five years, the Java programming language has been steadily gaining ground against C++, and older, structured languages. Its major strengths are portability, strong typing, and built-in support of networking, threading, and distributed computation. Most often, poor performance, lack of operator overloading, and limitations in sub-classing, are cited as weak points of Java. With the introduction of “generics” in the next major release, Java will add its own version of templates. The suitability for symbolic and algebraic computation has been discussed in [4], with respect to general features of the language, and in [7] with a special focus on run-time performance. The “Meditor” project [6] started out as a text editor that could process in-line mathematical expressions, and generate MathML output. Over time, it evolved into a small, yet impressive computer algebra system, entirely implemented in Java. It includes versions for handheld computer architectures. Industry analysts predict that by 2006, 60% of applications for mobile devices will be built in Java. Aspect-Oriented Programming (AOP) was originally conceived as a “post-” Object-Oriented Programming (OOP) method. However, AOP does not mean to replace OOP, it tries to complement it. As the introduction to [8] notes: “While the tendency in OOP is to find commonality among classes and push it up in the inheritance tree, AOP attempts to realize scattered concerns as first-class elements, and eject them horizontally from the object structure.” Indeed, “separation of concerns,” cross-cutting, and weaving are the main themes of AOP. Aspects add a third dimension to Java, where classes and interfaces constitute OOP elements. By defining “join points,” aspects can attach to data fields and/or methods, without jeopardizing OOP type checking. The most mature AOP library for Java is AspectJ [2]. We propose to employ AOP at several points in the design of Computer Algebra Systems (CAS). AOP can be used to decrease the amount of duplicated code, to check for special cases in a non-intrusive manner, and might even improve the performance of the system. A simple example would be the enforcement of domain-specific rules (e.g., for “add” methods that reside in disparate sub-classes). Using the additional “degree of freedom,” more elaborate type systems (e.g., in the spirit of AXIOM) can be built. In particular, aspects could be used to define algebraic structures over data types that are defined by Java classes, while interfaces would provide for restriction and/or composition. Our samples take ideas from the design of the GiNaC system [3], and the Java code of [6].