15.04.2018 Views

programming-for-dummies

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Scripting Languages 77<br />

Transferring data among multiple programs<br />

Built-in scripting languages can help you automate or customize a program,<br />

but what if you use a program that doesn’t include a scripting language? Or<br />

what if you need to transfer data between two or more programs, but neither<br />

program uses the same scripting language? In these cases, you’ll need to use<br />

a scripting language that isn’t tied to any particular program, such as Perl,<br />

Python, Ruby, or JavaScript.<br />

When scripting languages link two or more programs together, the scripting<br />

language programs are often referred to as glue. So if you have a Web page<br />

that lets users type in their names, addresses, and credit card numbers, and<br />

a database program that stores customer in<strong>for</strong>mation, you could use a<br />

scripting program to glue the Web page to the database. The user would<br />

type in<strong>for</strong>mation into the Web page, and the scripting language would then<br />

yank this data off the Web page and shove it into the database.<br />

Book I<br />

Chapter 3<br />

Types of<br />

Programming<br />

Languages<br />

By gluing programs together, scripting languages let you combine existing programs<br />

to create custom applications. Because scripting languages are interpreted<br />

rather than compiled, they can run on any computer with the proper<br />

language interpreter. So whether you use Windows, Linux, or Mac OS X, you can<br />

still use the same scripting language (and programs) on different computers.<br />

Creating separate applications<br />

Because scripting languages are so easy to understand and use, some scripting<br />

languages can create standalone programs. One of the most popular<br />

scripting languages used <strong>for</strong> developing standalone programs is Visual Basic.<br />

Unlike scripting languages, like Perl or Python, which link separate programs<br />

together, Visual Basic links program components together. To create a Visual<br />

Basic program, you design the program’s user interface consisting of pulldown<br />

menus, buttons, and check boxes. Then you write Visual Basic commands<br />

to link all these separate user interface components together to<br />

create a working program.<br />

Like most scripting languages, Visual Basic isn’t compiled to machine code like<br />

traditional <strong>programming</strong> languages, such as C++. Instead, Visual Basic programs<br />

get stored in an intermediate (p-code) file. To run a Visual Basic program,<br />

include a special run-time file, which interprets the p-code file and actually<br />

runs the program.<br />

Another popular scripting language used to create standalone applications is<br />

Revolution, which uses a scripting language similar to AppleScript. Like Visual<br />

Basic, Revolution doesn’t compile your programs into machine code. Instead,<br />

Revolution creates an intermediate file (p-code) that attaches directly to a<br />

run-time interpreter. Because the Revolution run-time interpreter can run on

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!