The glue of the software development industry is the //script//. A script is a typically a small program that performs some mundane but essential task. Scripts are typified by the following:
  • They are usually a single file program that controls the flow of execution of other scripts or programs. The file constitutes both the source code and the executable entity. Once the script source is typed in, it can be run with only a single conscious step. Typing the name of the script inside an appropriately configured console shell is usually sufficient.
  • They are usually written in a scripting language such as Windows Command Shell, VBScript, JScript, Perl, Python, Powershell and so on. These languages have the attribute that they can interpret and run the script source directly (see above) and that they provide a rich variety of utility functionality, such as regular expressions, environment variable control, and input/output piping for console applications. In contrast non-scripting languages such as Visual Basic, C# and C++ usually require multiple steps to turn source into a runnable program.

Another way to say it is that scripts are all about instant gratification. However scripting languages are usually weak in several ways:
  • Many scripting languages lack a powerful integrated development environment. Most script developers use simple text editors to write the script. This means they are not able to take advantage of the power of modern tools, which include such features as integrated help, code coloring, Intellisense® and so on.
  • Some script languages are write only. Scripts can be hard to understand, even if you wrote the script yourself. Some languages, such as Perl and Awk are notorious for this and such scripts can be very difficult for others to maintain.
  • Most importantly, most script languages lack a powerful debugger. Many, such as Windows batch files lack a debugger at all, and are subsequently very difficult to troubleshoot.

The .NET platform on Windows provides tremendous functionality. In particular the libraries that ship with .NET provide much of the functionality that script writers cherish, such as regular expression support. In particular:
  • .NET provides powerful languages such as C# and Visual Basic .NET that are easy to learn.
  • The .NET language compilers are fast. The C# compiler in particular is able to compile even reasonably large amounts of source into runnable code in sub-second times.
  • Hobbyist versions of the Visual Studio development environment are available for free, and provide a state of the art development environment and debugger.

The Code Runner .NET project is about investigating ways to bring the script writing community together with the existing .NET languages and Visual Studio tools and so make the task of script writing easier and more enjoyable.

Why is the project called Code Runner? The term "running code" probably has some roots in old home computer basic languages that typically use the "RUN" command to cause the users program to execute. Typically programs in languages such as C# are not directly runnable, but this project makes them appear to be so.

=== Functionality ===

At it's core Code Runner .NET is composed of the following components:
  • A code runner.** For C# programs this is a console program called csr.exe. This program is passed file containing C# source (typically with a .csr extension) , compiles it and runs the resulting image. The program also caches the resulting image, so that future invocations will be faster.
  • A scaffolding erector.** This program is called scaffold.exe. The purpose of this program is to erect project scaffolding around a .NET program so that the full power of the Visual Studio environment can be used to edit and debug the script. When Visual Studio exits, the scaffolding is torn down and deleted leaving just the "runnable" program file.
  • A library of utility routines. These enhance the .NET run-time Base Class Library (BCL) with additional features needed when writing scripts like programs. This library is called CodeRunner.dll.
  • Sample scripts.** The tool comes with a collection of sample scripts for you to use, modify and extend.

=== Community Benefits ===

Code Runner .NET is intended to provide the following developer community benefits:
  • Enhance the adoption of Visual Studio as the best way to develop for .NET and Windows.
  • Enhance the adoption of .NET languages such as Visual Basic .NET and C#.
  • Provide a faster easier way to write and distribute small utility programs for .NET and Windows.
  • Enhance understanding of the power of .NET's dynamic code compilation capabilities.

Last edited Aug 4, 2010 at 12:39 AM by jlyonsmith, version 3


No comments yet.