Subject: Re: CASP vs. The Tower of Babel

From: Andrew Dalke <[email-masked]>
Date: Mon, 28 Sep 1998 02:44:10 -0700

Gerald Loeffler <[email-masked]> stated:
> As a concrete example: It would be almost trivial to design
> an OO framework for Energy Minimization [...]
> 
> But is the resulting code efficient? It's certainly a lot
> slower than FORTRAN! (For language reasons and because you
> loose opportunities for source-level optimizations if components
> have to be truly independent of each other.)

There's some recent (within the last 4 years or so) work done
with C++ templates to push the performance of that langauge
to near-FORTRAN speeds using a technique called "template
expressions".  Interestingly, templates are pretty orthogonal
to objects, and I think that's a pretty important distinction.

Most of the things you're talking about,
> minimization strategies, potentials of mean force, integration
> algorithms, Monte Carlo moves, Genetic Algorithms
are algorithms which are "genericized" using templates, not
objects.

The biggest project I know of using templates for computational
work is POOMA from Los Alamos.  I also recall someone from UCSD(?)
working on a framework for biomolecular modeling, but I've
forgotten both the name of the project and the people working on
it.

> So why is there no collaboration on the code-level between
> computational scientists?

I know several reasons for why people might not distribute
their sofware:
  1) not worth it to them (eg, documentation, proper packaging,
support for multiple platforms, setting up web pages and ftp site,
etc can be a lot of work, even if you know what you're doing)
  2) worried their contributions won't be properly recognized,
  3) want to commercialize their work, especially if there is a
patent associated with it
  4) the software was written and maintained by grad students who
want to graduate -- it often is (just) enough to get the work done
or there's no single owner/developer that "owns" the software
through the transitions.  Of course, this is a minature version
of the same problem.

Then, when someone does make the source available, most of the
time it is under what I consider to be a too restrictive license.
For example:

  "cannot be redistributed" means I cannot make changes or
improvements to the software and give the changes to others.
Sometimes I can send the changes back to the author and have
them incorporated into the main development.  But what happens
if no more development is done on the project?  Or if the
development path is different than that one I'm taking?

  "educational use only" or "not for commercial use"  There's
a couple problems here.  I don't really care who uses my software
but if I base some of my work on a library that is not for
commercial use, I have to restrict with whom I can collaborate.
(There's also sticky points like, is a research group in a
for-profit hospital non-commercial?)
  The other big problem is I'm in a company now, so I cannot
use that class of software.  Yet I develop and release software
that others can freely use.  This most recently bit me when I
decided I wanted to experiment with mmCIF for use in Python
(perhaps as part of Konrad Hinsen's MMTK).  I didn't want to
implement a parser myself so looked at the mmCIF code from
Rutgers.  It was only for educational use, which means I couldn't
even look at the source.

Finally, even if the license isn't onerous, I agree that there's still
the problem you pointed out:
> traditionally computational scientists have been _lousy_
> programmers.

This also falls into several categories.  The biggest complication is
that there are a lot of self-taught programmers in this field while
the field of software development/engineering has advanced beyond what
most of those people know.  The example I gave earlier, template
expressions in C++, is one very powerful feature that few
computational scientists know about, much less use.

Suppose you're a computational chemist (this is CCL, after all :) but
learned programming mostly on your own.  Here's some problems I can
almost guarantee will be in your code, and which make software hard
for others to use:

  1) non-thread-safe functions
  2) no or poor exception detection and handling
  3) containers with only one iterator
  4) no concern for namespace collision
  5) reimplementation of standard library functions
  6) writing your own command/control/macro language
  7) poor definition of who "owns" certain data elements,
       especially strings

(these are not the standard beginning programming problems of hard-
coded array sizes, excessive use of global variables, fragile input
parsers, etc.)  BTW, my own code contained all of the above problems
until I learned why they should be avoided :) 
  Even then, there is rarely good documentation, especially of
the internals and reasons for making certain design decisions

Another difficulty is realizing that there are common approaches to
certain tasks.  If you want others to use your software you have to
use those approaches.  For a basic example, if you write something
that implements a binary tree, you should probably have items like
"parent", "node", "left_child" and "right_child".

Real situations are more complicated than that.  People are starting
to recognize and classify larger organizational patterns in software
(see the "Design Patterns" book).  By being aware that you are using
those patterns, and explicitly designing your software to support that
description, you help others who need to work with your code.  I'm
willing to bet that few in this forum have read that book, but it is
an important one in the software engineering field.

Finally, it takes a long time to learn the sense of what makes a good
interface and how to tell if what you're developing is specific to you
or is useable with somebody else's view of the world.  (My common
example here is a visualization program good for biomolcules but has
no concept of bond order or ring detection so poor for chemists.)

While I'm here, let me point out a problem I've had.  I like working
on software "infrastructure"; how to tie different pieces of software
together into a larger whole.  I think the computational chemistry
needs some work along these lines, and the lack of a set of commonly
used libraries for this field is helping restrict new development.
Who will pay for this work?  Or, in a university environment, there's
not enough physical science to make it worth a chemistry or physics
degree, nor enough computer science to make it worth a computer
science degree.

> (Regarding unwillingness to give away source code at all: With Java
> you can even give away the "object code" (byte code) (maybe after
> running it through an obfuscator) and it will work on any Java
> platform...)

Please no.  I ask that this not be common.  Let me quote from the
QCPE distribution here:

>      Commercial software firms will usually
> only make executable code available.  As QCPE
> is attempting to promote the development of the
> field of computational chemistry it has always
> been our philosophy to provide source code.
> Our reasoning for this is simple.  Unless the
> user has source code one has no idea about the
> science or should one say "alleged" science
> which is contained in the system.
> 
>                       Richard W. Counts/QCPE

						Andrew Dalke
						[email-masked]
---
Disclaimer: Opinion only, and not necessarily the viewpoint of my
employers nor even myself all the time.