Wednesday, February 17, 2010

More than command files

I've been experimenting with polymorphic programming in MS-DOS batch files. (Some call them "DOS scripts", others call them "Windows CMD scripts", and others have names that are not so polite.)

It's not object-oriented programming, but it is polymorphic. The experiment is for a number of Microsoft Visual Studio projects; I have a set of command files that builds all of them. Each project has a set of project-specific files, called by a set of core scripts that are common to all of the projects. The core scripts perform common tasks such as compiling a project and creating a testbed directory with the project's executable. A project can have "override" files that perform project-specific tasks, so if the general "run the program and capture the output" script is not suitable the project can supply its own.

There are three levels of specificity: general (cross-project), project, and test-within-project. (Each project can have multiple tests, and sometimes a test needs a specific configuration.)

So far, the experiment is working. That is, it functions, and it also reduces the coding in scripts. (It also reduces redundant code, which is a win.)


No comments:

Post a Comment