Mathematica 9 is now available

Wolfram Library Archive

Courseware Demos MathSource Technical Notes
All Collections Articles Books Conference Proceedings
Title Downloads

Object-Oriented Modeling with Objectica

Stephan Leibbrandt
Organization: Symbols and Numbers Mathematische Software GbR

2007 Wolfram Technology Conference
Conference location

Champaign, IL


Mathematica has tremendous capabilities to solve problems by means of functional and imperative programming. But the bigger such a model gets, the more difficult is it to keep track of the program flow. This is caused by the fact that concise objects of the real world cannot be directly represented in the Mathematica language. Having object orientation at hand, you can intuitively map real-world problems onto the mathematical models. Additionally, modularization and hierarchization are byproducts that allow you to keep model units small and clear enough such that the overview does not get lost.

Objectica is a commercial third-party application that adds to Mathematica this paradigm of object orientation. It is seamlessly integrated into Mathematica without using any external package or programming language and yields full access to all capabilities of Mathematica without posing restrictions on the user. This includes the fact that all internal Mathematica symbols keep their meaning outside an object context. The implementation of the package is guided by the need of a simple formulation of models while keeping the runtime overhead for object orientation as small as possible.

One aspect of convenience is the robust design and the straightforward syntax that are very close to Java and C#, including, for example, identical keywords and a broad usage of the dot operator to select members instead of more complicated phrasing by means of function calls or rules. Programmers familiar with Java or C# can therefore step quickly into the usage of Objectica. Another feature is the automatic scoping of model variables in model equations such that Mathematica's solving functions like NDSolve can be used easily, although they are not aware of object orientation. The applicability of Objectica is supplemented by the fact that almost all principles of Java and C# are realized. This includes serialization of classes and objects, constructors and destructors, C#-like properties, hierarchization by inheritance, polymorphism, encapsulation, abstract classes and class members, interfaces, and objects of anonymous classes. Finally, all functionality is fully documented in a manual of about 180 pages; a short description can be found at

Our presentation first shows how to use Objectica and how models are implemented in an object-oriented manner. We outline the four main paradigms of object orientation: abstract data types, inheritance, encapsulation, and polymorphism. Similarities and differences to Java and C# are demonstrated and a few concepts beyond these languages are addressed.

Second, some small applications clarify the interaction of Objectica and Mathematica to solve algebraic and differential equations. Among others, a differential equation and a ray-tracing problem are investigated.

All this shows how well Objectica is suited to model the real world in the form of objects used in algebraic and differential equations.

*Mathematica Technology > Programming
*Mathematica Technology
Downloads Download Wolfram CDF Player

Objectica.nb (1.3 MB) - Mathematica Notebook [for Mathematica 6.0]