Pondering God in Fortran

This week, I have to stop avoiding a task at work that I’ve been dreading. I need to learn the inner workings of some software that our group has been developing and using for nearly 20 years.

I’ve been dreading this project, not just because I dislike working with Fortran 77, but also because the code is a mess. The code started as a routine that solved a set of differential equations. Loops were written surrounding that routine to handle different initial conditions. Other routines were written to bring in information about the systems we model. If statements were placed haphazardly to handle special cases. More code was written to produce plots (using our own home-built plotting package, because this all started before commercial ones were able to produce nice results), and that was stuck in the main file. Finally, someone wrote a set of C++ routines that used the output of the original routines as its input, but embedded the new routines within the original convoluted structure of the code.

This type of thing seems to happen often when physicists, applied mathematicians, and engineers develop software over many years, without any input from anyone who has taken a computer science course.

Unfortunately, there are only two people left in the group who know how the code works, and everyone seems to think that I am one of them. I started documenting the code today, because eventually I want to re-design it. We have a script to call the code, because the input is so complex. There are about 50 parameters that need to be set, and I only know what 10 of them do. The output from the code is a similar mess. I counted about 40 output files, of which I’ve only used one in my own work.

All these inputs and outputs, and all of the if statements and loops within the code, were needed at one point. Some of the plots were used to verify that different sub-routines were working properly. Once they served their purpose, however, they were simply left in the middle of the code. A lot of these features were probably implemented for one of the several dozen analysis projects that our group has carried out. They are unlikely to be used again, but are kept around “just in case.”

In a way, this code reminds me of some aspects of our genetic code. Biologists only know the function of about 2% of the DNA in any given plant or animal. Some of the remaining 98% or so of the DNA might have functions that we simply haven’t identified. Like the plots produced by our Fortran code, the DNA might only produce useful products under very specific circumstances, such as when embryonic growth must be regulated. However, a lot of it might just be doing nothing.

The way DNA is arranged seems similarly haphazard. The human genome is arranged into 23 pairs of chromosomes. The Adder’s Tongue Fern, on the other hand, has something like 700 pairs of chromosomes. Why would a fern, which doesn’t need to move, hunt prey, or perform elaborate mating rituals, need all those chromosomes?

However, all of this makes sense in the context of evolution. New features are added to the genetic code that give it more functions, yet there is no reason to take away pieces of code that no longer do anything. Something similar happened with our Fortran code. Now both look like a mess.

I realize that this is a poor analogy, but deconstructing bad analogies can help clarify how something really works. In the context of biology, evolution occurs through natural selection, when random mutations improve the survivability of a species. This is not how our code evolved. If it did evolve through random mutations and natural selection, we would have millions of copies of the code, only a small number of which would work. I’ve only been able to find a few versions of this code.

Perhaps I can think of our code evolving in a way more similar to that which Lamarck imagined, 60 years before Darwin and Wallace came up with the modern idea. Lamarck believed species evolved for two reasons. First, there was a natural tendency for life to get more complex. Second, an organ would become exaggerated as it was used more (like the giraffe’s neck). Neither of this is true in nature, but at first I thought it might do a fair job of describing our code, which acquired new characteristics whenever we decided that we needed them.

In the end, though, the biological analogy works poorly because our code didn’t acquire changes through accidents, or through its own striving, but because we, the authors, added features. So, instead, why don’t I turn the analogy on its head, and consider whether the evolution of our code can be used to develop a new concept for how a biological system might evolve? It should be amusing at least.

Now, I’m not suggesting intelligent design here. After all, our code is barely designed, let alone intelligently so. I see no point in pushing that analogy. Likewise, I see no reason to force the traditional Western conception of a deity as an infallible, all-seeing creator into explaining the messy world of genomics. Instead of relying on ancient texts and the traditions of our forerunners as the basis for inquiry, why not consider what our DNA might say about theological questions?

My (strained) analogy between our Fortran code and DNA suggests that one might think of a creator as an author that learned as it went along. At first, it created cells, at that was good. However, it then thought that the cell should have little hairs help secrete important chemicals, and that seemed better. Then, the creator realized the hairs could be used for propulsion, and flagella appeared. This went on, with experiments in multi-celled life, spinal cords, central nervous systems, and so on. Eventually, we ended up with humans, who are spectacularly good at figuring things out, manipulating their environments, and populating the planet. However, humans are far too often are dogged with detached retinas, mental illness, back pain, and really difficult childbirth. The planet also ended up with a myriad evolutionary dead ends, vestigial appendages, and huge blocks of code that weren’t being used (and haven’t been documented).

If only the creator had taken a good software architecture course in college.

I realize that my analogy is still bad. Theologians probably won’t be happy with the fact that my hypothetical creator is constrained to act — and learn — in time. Time, as we understand it, is connected to space in our theory of gravity, and is therefore a property of this Universe. Can a creator even be contained within its creation? This seems like a paradox to my mind, which is untrained in metaphysics. In any case, I don’t believe that evolution requires a creator to intervene at each step; chance mutations and natural selection seem to be effective on their own. I do think, however, the logic behind using intelligent design to describe biology is equally bad as my initial analogy above. . .

Good design would have produce a code that was modular, that had related information organized into structures, and that output a well-documented data stream (rather than 50 random plots). Fortunately, I get another shot at our group’s code, and I hope to instill a more intelligent design.

  1. Hi,

    I just finished reading an ‘article’ you wrote- dated 2003- about your journey through the Local Church. I was introduced to this group just over 6 months ago and enjoyed my first 3 times with them over 3 months in a seminar on the study of the book of Romans. However, spending a week on a pre-training camp with them one month ago in London made it clear that many things were very wrong and I knew that I couldn’t look forward any further to anything meaningful developing between me and them. Though I did meet some beautiful, zealous young people who made my stay worthwhile. From this experience though I’ve questioned the likelihood of anyone in the Local Church really coming to know God personally, outside of the Local Churches practices and exercises.

    I was also particularly interested in your ‘existentialist’ experience as I’d been that way, so to speak, in my mid to late teens and out of it found Christ, all alone (me, that is) in the back of a classroom. All in all, there was an anti-climax to your journalled experienced or maybe my appetite/anticipation for more just not being satisfied. I enjoyed though your poignant expressions, your honesty, as it appears, your writing as to clear your own thoughts and not to please an audience and so I wondered where you are now in the scheme of all that???

    I’ve also loved Physics but only studied it for a short period (my bachelors/first degree), not before nor after and that came out of God’s leading, but me amidst self-doubt not trusting Him to go further to do EEET at MIT instead, even though my short study of the subject landed me with a First Class Honours.

    By this you can see why my curiosity has been so highly aroused to know more, to find out more where you are at in your ponderings/beliefs/discoveries about God.

    Please don’t find me out of place to ask. I understand that this blog site concerns a totally different matter but I’m fresh out of reading that earlier ‘article’ I mentioned and was just glad to get a site to contact you.

    So if you won’t mind, where are you at about God??? And by the way, I am a christian who though don’t always have highs in my life with Christ am profoundly blown my personal experience with Him.

  2. I am agnostic. It has been about 14 years since I considered myself Christian and wrote the pieces to which you are referring.

    However, among other things, I still am interested in how science informs the beliefs of people of faith. My underlying thought when writing this post was that, if there is a God, a good way to learn about It would be to examine how It organized the Universe.

    Part of the reason that I am not religious is that I believe that any deity responsible for the natural world is, at best, disinterested in many of the morals that I hold dear. At the same time, I realize that my understanding of the Universe contains significant gaps, and that my sense of morals is derived from the culture that I grew up in. That is why I do not rule out the existence of God.