Having fun with Classic ASP

To view this screencast, add it to your cart and checkout. You can buy this screencast for any price, including FREE!

Don’t Try This At Home

OK, now that I got that out of the way … what am I doing playing with good old school Classic ASP?

Basically, I’ve been thinking about JScript (Microsoft’s ECMAScript implementation) for awhile. JavaScript is a highly dynamic, relatively awesome language.

So … if we had access to such a great language for server-side web programming with classic ASP, then why did classic ASP suck so bad?

If we could go back in time and, knowing modern-day web development frameworks, start coding classic ASP … would we have made beautiful Rails-like frameworks? Is it even possible?

So, one day in November, after a few beers, I decided to try to implement Rack in classic ASP … and so I did. And I tried to implement the basics of Sinatraand so I did.

Over the Thanksgiving break, I implemented more of Sinatra as well as the basics of a DataMapper/ActiveRecord-esque ORM.

A few examples:

1 req(uire('rack/rack'));
2 
3 run(function(env){
4   return [ 200, {}, ['You requested path: ' + env.PATH_INFO] ];
5 });
 1 var db  = DB.odbc("an odbc system dsn");
 2 var Dog = db.model("dogs");
 3 
 4 get('/', function(){
 5   return 'Hello from home';
 6 });
 7 
 8 get('/dogs/:name', function(name){
 9   return "You're viewing the dog: " + name;
10 });
11 
12 post('/dogs', function(){
13   var dog = Dog.create(this.params);
14   this.redirectTo('/dogs/' + dog.name);
15 });
16 
17 run(sinatra_app);

If you’re interested in modern server-side JavaScript, there are lots of active projects out there.

Let me know if you’re more interested in server-side JavaScript and I might do some follow-up screencasts on how to use some of the modern tools / frameworks out there.

There’s a lot more too. The most important thing, imho, is CommonJS. Want to write a command-line application in JavaScript? Well … how do you print out to the console or get the passed arguments? All of these things are included in the CommonJS spec. And there are a number of implementations available now!

Anyway, if you want to see what I coded on top of classic ASP (because … why not?), watch the screencast or view the code at:

http://github.com/remi/classic-asp