Better than QuerySim!
I have been a big fan of QuerySim since Hal Helms introduced the idea years ago (it was later made into a UDF). It is a great way to prototype an application. What I don't like, however, is that I have to type in the fake data and then later remove what I have done.
I understand the idea of "booster rocket" code that I have to throw away, but I would ideally like to avoid it. Even so, I have always liked it and used it extensively.
While working on a recent project, I got to the prototyping stage and thought "There has to be a better way.". I didn't want to type in the simulated date any more.
I found a QuerySim Generator . This seems like a neat idea, but still takes about as much work as typing in values for QuerySim and still produces throw-away code.
Then it hit me. DataMgr! I have been using this tool since I created it in December of 2004. I define my database structure using XML and then use DataMgr to have the application make sure that it has the structure it needs (Peter Bell points out that the Ruby on Rails folks call this ActiveSchema ).
What I really wanted was a way to use the exact same CFC code to work with simulated data. Then my front-end code wouldn't have to change at all once I hooked up my application to an actual database - my CFC might not need to change either.
The resulting work led to a new DataMgr component for a database type of "Sim". DataMgr_Sim.cfc acts just like every other DataMgr component. The only difference is that no real database is involved. All of the data is simulated.
This simulated data can't be added, deleted, or updated (though it may act like it can). It will, however, produce appropriate simulated data for the column types that you are using.
You can also limit the number of rows returned by DataMgr_Sim.cfc in the XML (using the "simrows" attribute) or using the "rows" argument of the init method (only relevant for DataMgr_Sim.cfc). The simulated database will also use seed data instead of randomly generated data for any table in which that is provided.
Brian Kotek's article on QuerySim has some good ideas on using QuerySim.
DataMgr_Sim.cfc is only available as part of DataMgr 2.0 (currently in Beta). Feel free to try it out (I am currently using it on several production sites).
There are no comments for this entry.
[Add Comment]