Previous | ToC | Up | Next |
Our goal is build a laboratory to study the interactions between stars.
Since stars don't fit in traditional laboratories, we have no choice
but to use virtual stars in virtual labs. The computer provides us
with the right virtual environment, and it is our task to write the
software that will correctly simulate the behavior of the virtual stars
and their interactions. Once that software is in place, or at least
enough of it to start playing, the user can provide a starting situation,
after which our software will evolve the system, perhaps for a few
billion years.
In this book we will focus in detail on the whole process of developing
the software needed. We will aim at realistic detail, showing the way
of thinking that underlies the construction of a complex and ever-growing
software environment. We will require a bit of patience, since it
will take a while to have a full package in hand for modeling, say,
the long-term behavior of a star cluster, and we are presenting in
this book only the first few steps. This drawback, we feel, is
more than offset by the advantages of our approach:
We want to convey some of the atmosphere in which large software
environments are grown, in a dynamic and evolutionary way, often
starting from very small beginnings -- and always surprising the
original authors when they see in what unexpected ways others can
and will modify their products in whole new directions. Most of our
narrative will follow this process step by step, but occasionally we
will turn away from the process to the players: the developers writing
the software. We have chosen one representative of each of the three
target groups mentioned in our preface, from natural science, business
and computer science.
The setting is an undergraduate lounge, where three friends
occasionally hang out after dinner, and sometimes tell each other
about the projects they are working on. Tonight, Erica talks with
great animation to her friends Dan and Carol. Erica is an
astrophysics major, Dan is currently studying biology but preparing to
go to business school, and Carol majors in computer science.
Erica:
Guess what! Today I was asked to choose a student project, for
me to work on for half a year. Many of the choices offered seemed to
be interesting, but for me the most exciting opportunity was to work
on the overhaul of a laboratory for interactions between stars.
Dan:
What are the interactions that are so interesting?
Erica:
Imagine this, the current software package allows you to create
a star cluster and to let it evolve for billions of years, and then
you can fly through the whole four-dimensional history in space and
time to watch all the collisions and close encounters between normal
stars and black holes and white dwarfs and you name it!
Carol:
If that package already exists, what then is so exciting about
an overhaul?
Erica:
Yes, the package exists, but every large software package tends
to grow and to become overweight. As you both know, this is true in
business-driven software projects, but it is even more true in science
settings, where the value of clean software engineering is underrated
even more than in profit-oriented areas. As a result, by far
the most reasonable and efficient way to extend older packages is first
to do a thorough overhaul.
Dan:
I see. You mean that rewriting a package is worth the time,
presumably because you have already figured out the physics and you
have similarly built up extensive experience with hooking everything
together in various ways in software.
Erica:
Exactly. Rewriting a package takes far less time than writing
it in the first place -- if we want to keep the same functionality.
In practice, it may take longer than we think, since we will for sure
find new extensions and more powerful ways to include more physics.
As long as we don't get carried away, and keep our science goals in
sight, this extra time is well spent and will lead to greater
productivity.
Carol:
I wonder, though, whether a complete overhaul is desirable. I
have just learned about a notion called refactoring. The idea
is to continuously refine and clean up code while you go along.
Erica:
Yes, that would be better. In fact, I already had a brief chat
with my supervisor, a professor specializing in stellar dynamics,
and he mentioned just that. He said that this was
the last really major overhaul he hoped to do for his software
environment. The main reason for the planned overhaul is to make
it flexible enough that the system from now on can grow more
organically.
Dan:
The overhaul that will be the end of all overhauls!
Carol:
Well, maybe. I've heard a lot of hype about programming, in
the few years that I have been exposed to it. But the basic idea
sounds good. And even if you will have to overhaul in the future, a
cleaner and more modular code will surely be easier to understand and
disentangle and hence to overhaul.
2. The Gravitational N-Body Problem
2.1. Background
2.2. Our Setting
Previous | ToC | Up | Next |