Saturday, November 06, 2004

Scripting and Smalltalk

Lots of new dynamic languages have come along and tons of programmers are discovering the productivity gains of no compilation wait times and immediate feedback. But, the environments for these new languages are still based on files and dead systems. One advantage Smalltalk has is that the environment is alive (you can change the environment without shutting down, everything is well ALIVE!) and I think this makes a perfect playground for scripting as well as application development. While most folks use Smalltalk for ultra-complex business applications because they like spending time with their kids, but Smalltalk can also be used for scripting. You see you can get access to the compiler, compiled code, and even the runtime stack (you can even change it!)! Now, even most scripting languages don't give you that kind of power! The only other language I can think of that does is LISP. Anyway, back to the topic at hand. We all know that scripting is helpful for kicking off systems, moving files around, querying the state of a running application, and etc. This is available off the shelf for every Smalltalk dialect that I know of. The cool thing about scripting in Smalltalk is that since you have a powerful environment around you, you can write your script in a workspace. Now, if your script gets too big, you can start moving it to classes and refactoring. You can also move scripts to external files and load them in a runtime. Why do you configuration files when you can have runnable code that does it for you? Let the objects do the talking! Scripting is also great in running systems. If you run Smalltalk in headless mode, you can have scripts that query the state of the system while it's running! This can be very powerful and DANGEROUS! But, wait a minute, we have access to the compiled code and we can actually query the compiled code to make sure it doesn't do anything nasty. The bounds are limitless and once you start thingking about them, you wonder why am I writing unix bash scripts and then, you might be wondering, why not have the power of a compiled language, but the expressive power of an interpreted one? Smalltalk is all that and a whole lot more.

No comments: