Prashant Deva's blog

Talks on technology and the latest developments in Placid Systems.

Inside Virtual Ant : Script Writer's Dilemma

Saturday, August 04, 2007

Today I will talk a little about the design of the Virtual File System (VFS). The VFS lies at the core of Virtual Ant and it is what allows Virtual Ant to have all its magical capabilities.

One of the major problems we encountered while designing the VFS,and which has affected the design of the VFS in many ways, is what I like to call 'The Script Writer's Dilemma' .

Here is how I like to define it -

The Script Writer's Dilemma occurs when the state of the file system while writing the build script is different from that when it is run. In such a case the person writing the build script may see a different result on running his build script or may not see any result at all.

As an example consider this, say you create a script which copies all files in folder 'a', that have been modified after Jan 2008, to folder 'b'. Then you have more tasks which manipulate the files in folder 'b'.

Now lets assume, you are creating this script in Dec 2007. Now in an environment like Virtual Ant, when you run the above the script, you wont see any files in folder 'b' cause its still 2007. And since there is nothing in folder 'b', you wont see anything while executing all the other tasks that manipulate on the contents of folder 'b', thus rendering the whole visual environment useless.

Thus we decided not to include any concept of modification times in Virtual Ant. So when you run the above script in Virtual Ant, it will take the worst case and copy 'all' the files in folder 'a' to folder 'b', since it is quite possible that at the time of running the script every file in folder 'a' really has been modified.

Thus you get a twofold advantage -
  1. You handle the worst case of every file in folder 'a' being modified.
  2. You also get to see the result of all the other tasks that operate on the contents of folder 'b'.
For those proficient in Ant, that means that when using a 'date selector' or when using a task like 'depend' , every file will be returned.

Note that this The Script Writer's Dilemma is applicable only in a visual environment like Virtual Ant. In a text editor since you are essentially 'flying blind' anyway, it really doesn’t matter.


posted by Prashant Deva, 12:54 PM


Add a comment