Web programming for people who really like to program!Run BASIC allows you to apply your desktop programming skills to create web applications without struggling with the overhead of typical web programming frameworks.
Unlike other web programming technologies, with Run BASIC there is no state to manage, you don't need to GET or POST anything, and you never even have to think about the Common Gateway Interface. You can easily deliver interesting and rich applications that are difficult to deliver with other tools. Run BASIC hides the web technology so you can just code.
Honoring a Tradition of Simplicity
Run BASIC is a version of the BASIC programming language. BASIC was designed from the start to be easy for the non-computer scientist to use. A small language with simple syntax and English-like commands, BASIC is easily learned. Modern implementations of BASIC also add important features such as support for structured programming and scoped subroutines. Inspired by the approachability of BASIC we decided to create a web programming system with those important qualities.
When BASIC was at the peak of its popularity in the 1980's most people who used it were users of home computers. These were usually 8-bit microcomputers that plugged into a television set. With the flick of a power switch the user would almost instantly see something like this:
SuperDuper BASIC v2.3
15485 Bytes Free
So the user was able to immediately begin typing commands and programming the machine. Instead of booting into Windows the computer booted into BASIC which was the operating system of the machine.
Run BASIC is similar in its conception. Everything you need to write web programs comes built right in . Just start it up and you're ready to create something useful. People familiar with web programming aren't prepared for its simplicity because they think that CGI programming is easy. People who've never written a web program before will quickly take it for granted that all web programming is so simple.
Some web programming languages are modules that you load into a web server like Apache. The trouble with this approach is that you need to know about web server technology and programming too. Actually there's more to it than this because you also need to learn about session management and about preserving state between requests. If you want to draw graphics or work with a database you have to load separate modules.
Because we believe that most people would prefer to just get down to programming and forget about all the complications of web technology, Run BASIC is built on top of a web server and it hides all the complexity. It includes everything and provides a friendly face.
Run BASIC has a single installer. Once you have it running a single button launches your web browser and connects it to the Run BASIC server. This becomes your programming interface. You write code and test it right away in the browser. You can type a little code and click the Run button to see it run right away.
In the tradition of the BASIC language, you can see all of your code in the one editor. This is a really important because most modern web tools force you to break your program code up into different pieces. Run BASIC also lets you put your code into separate files (or modules) if you want to but being able to see everything in one place is very handy for simple exploration or small projects.
Control Flow and State Management
One very special feature of Run BASIC is that you can write a simple interactive program in the classic terminal style. Creating this kind of software is a lot of work in most web programming systems. Here is a quick example:
BASIC programmers will recognize this as the sort of code they would write on their Commodore or TRS-80 computer, or using QBASIC. This simple example works exactly as you would expect it to, but web programmers don't get to write such a simple program with so little code. It must be broken up into a web page that asks for the columns and rows, a script file to generate another page with the table and to ask to do it again, and then another script file to process that request. The values for cols and rows also need to be passed from the first page to the script that generates the table.
Run BASIC does all this work for you automatically. There are fewer files and less code.
Automatically Generated HTML
Another benefit of generated HTML is that Run BASIC will not forget to match up the opening and closing tags.
Graphics: One thing that people find useful and fun is the ability to draw graphics, but this is not easy in web programming systems. Here is a very simple program that creates a graphic object and then uses it to plot a sine wave. The RENDER statement at the end simply instructs Run BASIC to 'PRINT' the graphic to the web page.
The result is a graphical sine wave drawn directly into the web page.
One of our users wrote a graphical hangman with no prior web programming experience.
Database: Many times it is handy to keep information in a database, and so we decided to integrate the excellent SQLite database engine. The special qualities about this particular database include that it does not require installation or trained administrator and there is no need to tweak any settings. It just works. This simplicity fits well with the spirit of Run BASIC.
Here are a few lines of code that show how to get some data out of a database and show it on a web page:
Widgets: Creating a user interface with widgets like buttons, links, listboxes, etc. has been designed to be as simple as possible. The user PRINT statement to display text and numbers. This happens just like on a printed page from the top. Widgets are added into the flow of the page in the same way.
Here is an example:
The button invokes the [makeItHappen] handler. You can also specify a named subroutine if you prefer, like so:
The name #go gets passed in as a string to the key$ variable of the subroutine. Other widgets also use event handlers in the same way.
Components in Applications
Run BASIC provides a simple way to let programmers create components for their web applications by using the tried and true RUN statement in a novel way. Any program that is run can then be used as a component, which can optionally be rendered anywhere on a web page by using the same RENDER statement demonstrated above in the sections on graphics and database features.
For example here is a program which let's the user type in a color and click Go! to draw a sine wave of a desired color.
And here is a very simple program that embeds the above program as a component onto the page.
The embeddedSine.bas program runs all the way down to the WAIT statement. The colorSine.bas component remains interactive. The user can type in a color and click Go! as many times as desired and the structure of the embeddedSine.bas UI is maintained.
Components do not need to be rendered onto the user interface. They can also be used as libraries of shared code or even as objects in an object oriented fashion.
Web 2.0 Features
Since Run BASIC is a web server it has commands for communicating with other Internet systems and since it is BASIC it makes sense for these commands to be really easy. You can programmatically:
- Fetch the contents of a web page from another server - Submit information to another server and get a response
- Send email using SMTP
A built-in XML parser makes it easy to read information out of what you get back from other servers.
Support for Styling
Once you've got a program running and working just the way you like, Run BASIC's support for CSS and HTML makes it easy to pretty up your web application.
Run BASIC treats DIV tags as a first class structure by making a code block for it so the compiler can enforce good structure. Then you can apply CSS styles for those DIVs directly in the code.
Here is an example:
To Learn More Visit www.runbasic.com
Carl Gundel is an object oriented software expert and programming language designer and is the president of Shoptalk Systems.
Participate in your Design Center
Lots of fun and information for all... don't forget, any community is only as good as the participation of its members. We invite your tips, tricks, comments, suggestions and camaraderie.
- Ask for the DT&G Monthly: to receive DT&G newsletter each month, happenings in the Design Center and regular columns like the "Mail Bag" and "Cool Sites"
- Discuss Design & Desktop Publishing : in the Designers' CAFE
- Link to this site, and then show us the link. We'll send you any of our current door prizes, just for your trouble.
- Discuss Photoshop at Photoshop 911
- SUBMIT: a news link, new font, or product review
- REVIEW a website: posted by our readers
- SUBMIT a Website: for review in Web Design & Review
- Submit a Critique: of a popular web site, or YOUR web site!
- WIN PRIZES: in our "Question of the Month" column
- Meet Friends of the Design Center people who care!
- Become a Friend of the Design Center: and put your link on the front page
- Submit News, Views or your latest press release
- Submit your Software Review: shareware, freeware, fonts, graphics, utilities -- if you've found software you like, let DT&G readers know about it!
Learning, training, tips, tricks, and moreThe Design Bookshelf team reads and reviews the best books for the creative visual designer, desktop publishing practitioner and visual communicator. If you want to know it -- we'll show you the very best way to learn it... in the Designer's Bookshelf
Get more out of your computer: join a user group - There are computer clubs around the world called "user groups" where you find fellow computer users ready and willing to share a wealth of information. If you're not a UG member, you should be.. find a group at the User Group Network