What is Interactive Programming?
Interactive programming, also known as live coding, refers to any computer programming language that allows the creator to make changes to the program while it is already running. In traditional programming, the coder first writes out the program and then saves it. He then runs the program on the computer. If an error occurs, it's back to the drawing board to type out new code and run the program all over again. With interactive programming, the designer can make changes to the code without having to run the program over again.
Another use for interactive programming is to allow input from the user in what is called an interactive application. This can be as simple as asking the user for her name and then displaying it on the screen. The program has an interactive element by changing the value of the user's name based on what she types. When the program was created, it did not know her name and the value was blank. Once it learned her name, it put that value into the program while the program was still running and then displayed it on the screen.
This type of interactive programming is in contrast to another programming process known as batch processing. In batch processing, the program can run without ever needing input from the user. This has the advantage of running on its own without needing the user's help, but does have one major drawback. All the information needed for the program to run must be coded in to it from the beginning. If the program wanted to display the user's name, it would need to know it already, as it could not ask for the user's input.
In the creation of a program, it goes through development cycles. These cycles start out with identifying what the program should do, writing the code for it, and testing out the program. The designer then goes back and makes changes to the program and tests it again. This process repeats until a successful program is created.
When interactive programming is used, the distinct lines between stages of the development cycle become blurred. Writing the program and running the program become one and the same. Instead of writing the program and then executing it, the developer can write the program, run it, and continue to write or make changes to it while it is running. This allows for much more flexibility in programs, and allows the programmer or user to make changes without restarting the program.
@Mammmood - I think that the only use for batch programming, based on my own experience, is to use scripts that run scheduled jobs. They were actually called batch scripts for that reason.
They could be programmed to run unattended, mainly for evening jobs or stuff like that. You could also incorporate them into the program to do stuff that the user is never supposed to see, but is important for the proper functioning of the program.
@MrMoody - I think that the real uses for interactive programming, at least on a very complex level, would be some game development environments.
Games can be extended and expanded as you go, allowing the user to create new universes and objects and behaviors. I believe that would be an example of an interactive program that gave the users maximum flexibility.
In either case, it seems that such a programming environment might be very complex. How do you make sure that the users don’t write code that doesn’t break your main application logic?
You need to define boundaries between what the user can do and what the application can do. Probably you would have checks in place too, in order to ensure that proper values and stuff are entered into the program.
@David09 - I think that there are two definitions for interactive programming here. The article talks about taking user input and then displaying it. That’s an interactive program, but it’s not the kind of interactive programming discussed in the main paragraph.
That type of interactive programming involves changing code on the fly – most programming languages don’t let you do that! I’ve never done that, anyway. I admit it would provide you with a lot of flexibility but I don’t think it would be useful for independent software vendors (such as the company I work for) which want to keep the code base compiled for security reasons.
I’ve been doing computer programming for over ten years now, and I must say, I’ve never done the kind of interactive programming described here. I think there are limited applications for the kind of programming that is truly interactive.
I can imagine a financial application as one example. Suppose this application lets you add your own custom functions. You can embed a custom script inside the financial application that performs those functions.
I don’t know if this is exactly interactive programming or not, since the program is already compiled and the scripts are executed on the fly, in a separate memory space, but it seems to come close.
Post your comments