The Truly Dynamic Program

time to read 5 min | 927 words

I've heard about code that write code, and dynamic programming, Lisp, Linq, Native Queries, and all sort of other stuff. Those are cool, this post is about the other dynamic program. The code is written in a mixture of unix shell scripts and PL/SQL. I'm running the code in my head, reading it in notepad. I'm certain that there are some very good tools to debug shell scripts, and there might be a way to debug PL/SQL, but I'm pretty sure that there isn't something that will let me seamlessly move between one and the other. My current task is to produce a rough documentation of what the code does, so we can decide what to do with it.

I can't really express my horror better than with the following story. The issue here is generating a view in a database. I'm tracing what happens through:

  • The main shell script:
    • Call to a second shell script
      • Run a SQL script
        • Generate a set of SQL commands by string concating with some values from the database
          • Run the generated script
            • The script calls to another shell script with some values
              • The script calls to a SQL script that generate code
                • The code that was generated actually create the view

And, and this is important, this is not the biggest WTF in this codebase. I'm not kidding.