In the last section we collect some thoughts and summarize some of the
early scientific users'experience with OO.
The object model provides a very natural language for modeling Nature,
one that could closely mimic in software most mathematical structures used
by natural scientists. The principle of abstraction, a basic pillar of
natural sciences (and of any other science) is one of the most fundamental
concepts in object-oriented design. Because of abstraction one can attack
difficult problems by isolating relevant features for the piece of reality
to be captured in the model. Also, abstraction allows one to find common
characteristics in apparently very different problems. Moreover, abstraction
sometimes permits the "decoupling" of various aspects of a problem
into "orthogonal" components which can be mathematically modeled
(or implemented in software) independent of each other.
OO is sufficiently mature to implement many physical models. In particular,
the C++ language is widely available (on PCs, workstations and supercomputers)
and portable. Some OO languages appear well suited for the tasks of scientific
software development[12,13] In particular,
the class concept together with the facility to overload operators allows
user-defined data structures (such as rational numbers, vectors, tensors,
spinors, group theoretical operations,...) to be handled in same way as
built in types (such as integer or float)[14]
Library support is not as ample, and compiler technology is not as mature
for C++ as for Fortran (which has been the favorite scientific programming
language for more than forty years). Currently, code execution speed is
not as good as Fortran's. In fact, several workers are currently using
dual language (Fortran/C++) implementations[12] to get the best of both
worlds. Anyway, the situation in these fronts is rapidly improving.
Class libraries provide classes such as vectors, matrices,..., reusable
building blocks for larger problems. Object-Oriented building blocks are
flexible, permitting subclassing to satisfy user's specialized needs. (For
example, one might subclass the class TComplexMatrix to obtain
SU(3) matrices). Currently there are several commercial (M++[15]
, Math.h++, Lapack.h++,[16]...) and some
public domain (NIH class library [17],...)
class libraries for scientific computation. LAPACK, a well known linear
algebra library, has already been extended to C++. ScaLAPACK++ is an object-oriented
C++ library for implementing linear algebra computations on distributed
memory multicomponents[18] Available
numerical class libraries support arrays of various types, parallel arrays,
linear algebra classes, polynomials, random number generators, statistical
objects, geometrical objects,... In several National Laboratories, there
are teams actively working on challenging OO numerics projects. For example,
MatResLib is an OO material response library written in C++ at Sandia National
Laboratories[19] Some large scientific
projects are now being written (or rewritten) in C++[20,21]
Usually, the choice of an OO language over a procedural one has been made
to satisfy fundamental requirements such as portability, maintainability
and extensibility. For example, recently seven radio astronomy observatories
from around the globe joined forces to develop an OO data processing system
called AIPS++ (the Astrophysical Image Processing System)[21] that is to
replace an older system written in Fortran 66.
When programmed in procedural languages (e.g., Fortran) the physics
is closely interwoven with numerical analysis, memory management, the geometry
of the problem (such as shape of the container and boundary conditions)...[12,22]
Large bodies of codes are not only difficult to write, but are even more
challenging to debug. A very important advantage of OO languages is that
they can much better isolate numerical analysis, system geometry, etc.,
from the physics of the problem[12,22]
In addition, data abstraction enhances the comprehensibility of the code,
modules can be altered (debugged, modified, upgraded) without affecting
other modules. These nice features of OO have been exploited by many scientific
users. For example, sets of coupled partial differential equations appear
in a large variety of problems in physics, such as computational fluid
dynamics. A recent paper[22] considers
a Navier-Stokes simulator for compressible gas flow and uses adaptive mesh
refinement algorithms. The C++ code (the authors employ Fortran for low
level numerics) has been written in a "dimension independent"
fashion employing geometrical objects (e.g., intersections and unions of
"d-dimensional" box objects). Once the code was proven to work
in d = 2 then the extension to 3 dimensions was effortless. In the same
code, for example, it was also painless to add a parabolic term to the
Navier-Stoke equation to include diffusive transport of heat and momentum.
Previously, debugging the old Fortran code for the three dimensional problem
was mind boggling and the incorporation of diffusion term in the model
required much more effort.
OO is well suited to parallel computing. Objects are already "natural
units" to be distributed in a convenient fashion among the processors.
C++ can be extended to support concurrency (active objects own their threads
of control)[23,24] Parallel computing
using procedural languages has been very successful in large problems with
homogeneous structures (matrix computations, homogeneous fluids,...). Homogeneity
often guarantees a balanced allocation of work across the processors, as
well as efficient communication between nodes. More complex systems such
as disordered systems, inhomogeneous fluids,... suffer from space-time
irregularities For example, flow computations of inhomogeneous fluids may
require dynamically and locally modifying mesh size adding or deleting
nodes during computation. For efficient use of parallel computing, work
must be relocated at run time among the processors to maintain acceptable
workloads. Also, it is usually desirable to support the possibility of
node failures (fault tolerance) so if a node fails the computation is not
stalled. These tasks are naturally implemented using OO technology (e.g.,
customize active objects to manage workload distribution)[24]
Currently, parallel computing is reserved for a small group of practitioners.
This may not be a result of the intrinsic difficulty of the problem but
of tools, methodologies and development environment support used to treat
it. Some researchers[25] have attained
performance comparable to procedural technology in parallel computing,
with less effort, using OO technology and higher levels of abstractions.
Should a natural scientist become a programmer to take full advantage
of modern technologies, such as computer simulation, scientific visualization,
parallel computing, virtual reality,...? Of course, the obvious answer
is that natural scientists would like to profit from these powerful technologies
but also keep some time for science! Here, object techniques, and in particular
framework technology can prove very useful. Frameworks are reusable OO
designs for domain-specific problems. In fact, framework programming is
a logical extension of OO programming. For example, a team of physicists/chemists
could design a molecular dynamics simulation framework (using existing
class libraries and frameworks). [26,27]
This framework would contain all important features required to produce
(maybe, parallel) molecular dynamics simulations and display data in a
variety of useful forms (scientific visualization, virtual reality,...)[28]
Clients could use the framework as it is (as a canned simulator) but, with
little effort, they could tailor it to fit their needs. For example, they
could add additional particles, other type of particles, other properties
to existing particles, add/modify interactions, change boundary conditions,...
. This is simply done by subclassing and adding new methods and data members
to existing classes. Thus, frameworks could provide even to a "computer
illiterate" natural scientist (but who knows some basic OO design)
easy access to simulation, visualization, parallel computing, virtual reality,...
. The hardest work would be done by designers of classes and frameworks
at various levels. Natural scientists could devote their time to doing
science while enjoying simple, powerful and flexible computational tools.