Spiga

‘ Tech ’ category archive

More on Code as Data as Code

June 05, 08 by M. Holger

As an addendum to yesterday’s little writeup on data-driven design, here’s another little (perl) trick I’m particularly fond of, that relies on storing perl code as a hash element. The cool thing about this approach is that you can actually have a configuration file written in, say, XML, that can then reference procedures which are actually defined in the configuration along with the rest of the parameters — allowing you to abstract it away from the core application 100%.

Read the rest of this entry →

Data Driven Designs

June 04, 08 by M. Holger

One of the main paradigms I’m interested in working with when writing new bits of code is the concept of ‘data driven’ logic. On the surface this seems simple enough, but for the uninitiated the premise is that one should be able to dictate the logic of a routine via the input data, while doing little (if any) actual coding.

For instance, I recently ran into a situation where I needed to manage a series of input and output files, moving them from point A to point B. Most of the time we just need to rename the files en-route, but occasionally other manipulation might be required such as encrypting/decrypting the files, filtering subsets of data out, or performing other tasks.

Read the rest of this entry →