Building an Object Oriented Computational Algebra System Based on Design Patterns Virginia Niculescu Babes ¸-Bolyai University Department of Computer Science M. Kogalniceanu, Nr 1, Cluj-Napoca, Romania vniculescu@cs.ubbcluj.ro Grigoreta Sofia Moldovan Babes ¸-Bolyai University Department of Computer Science M. Kogalniceanu, Nr 1, Cluj-Napoca, Romania grigo@cs.ubbcluj.ro Abstract Object oriented programming and design patterns intro- duce a high level of abstraction that allows us to imple- ment and work with mathematical abstractions. Classic al- gebraic libraries, based on imperative programming, con- tain subalgorithms for working with polynomials, matrices, vectors, etc. Their main inconvenience is the dependency on types. In this paper we analyze and design the kernel for an object oriented computational algebra system based on de- sign patterns. This approach allows us to work not only with concrete algebraic structures, but also with abstract algebraic structures. The advantages of this approach are given mainly by the creational design patterns, by reflec- tion and dynamic loading, and by representation indepen- dence. These introduce significant flexibility and abstrac- tion. Using this representation we may work with abstract algebraic structures, such as: groups, rings, fields, etc., de- fine new algebraic structures, and operate with them in ab- stract and concrete ways. 1. Introduction In time, many algebraic libraries, that contain subal- gorithms for working with matrices, vectors, polynomials, etc., have been built [4, 12, 3]. The main inconvenience of classic imperative algebraic libraries is their dependency on types. Object oriented programming and design patterns form a very adequate framework for implementing a computa- tional algebra system. Here we analyze the design of an object oriented algebraic system, based on design patterns, which removes the inconvenience of type dependency. We will create abstract classes that implement general abstract algebraic structures. In the domain of linear algebra object oriented program- ming has already shown its power. The domain of compu- tational algebra did not record similar successes — at least based on OOP. Now the progress that has been made in ob- ject oriented analysis and design gives the possibility of rep- resenting and operating with different kinds of abstractions. The kernels of the systems that have been built for com- putational algebra are not based on pure object oriented pro- gramming. Such examples are: GAP (Groups Algorithms and Programming) [15] , Magma [16] and Axiom[14]. The advantages of OOP are considerable, so OOP and OOD have to be used from the early stages of development for a computational algebra system. The advantages of our approach result from the usage of: • creational design patterns – allow us to build not only a flexible numerical algebraic system, but also a gen- eral abstract algebraic system (these bring the most im- portant advantages of implementing abstract algebraic structures); • reflection and dynamic loading – allow automatic con- versions between compatible structures, and also allow dynamic creation of new classes that correspond to dif- ferent algebras specified by the user; • representation independence – allows us to operate with algebraic elements independently of how their component values are represented. 2. General Analysis In this section we are going to present a general analysis of the goals, and the main design decisions implied by these goals. Also, we analyze here what design patterns may help us achieve these goals. The main requirement is the possibility of working with abstract algebraic structures like groups, rings, fields, etc. The user has to be allowed to define concrete algebraic structures by using these abstractions. For the beginning we