Username:
Password:
Programming With Ruby Tutorials

Meet Ruby / Scripting Language

Subtitles of the Movie

In this video we're going to take a look at what is a scripting language. In the really simplest terms, a scripting language is a computer language that's interpreted rather than compiled. Now, there's some mysterious terms there. Interpreted, compiled, what does that mean? Well, essentially interpreted means that when you run, when you run the program that you've written in this scripting language; an interpretive program is executed line by line. In other words, you feed it into your interpreter, which a, a little program that will execute the program, and it executes each line step by step. So it hits the first instruction, takes it, converts it into machine code eventually, and executes it. Then it goes through the next instruction, does the same, and moves on its way down the code. Now, what it buys you is a lot of flexibility because you can change a lot of things on the fly. What I mean by that is you can, in, as your program is running it's very easy to change, modify, it ah ahead of the, you know, program point or whatever and have it have different behavior. What you lose is that that takes processing time to do that conversion of each line into that machine code. Instead of just being straight there, you have to go, every line has to go through these extra steps. So in a sense it's like an on-the-fly compiler. Now,again, I just used a different term there, compiler, what does that mean? Well, a compiler, a compiled language uses a compiler to take that language and convert it straight up into machine code like I showed you in an earlier video where we went from a program into the machine code, into a circuit. And a compiler does that in one step. So instead of going line by line executing the program and, you know, taking one line, converting it to machine code and then running it, it takes the whole program, the English-like program that we've written in whatever computer language, and it converts that right away to the ones and zeros kind of code. That's an extra step and it makes your programming a little bit less flexible because the turnaround is slower; you have to always got to go through that step before you can execute your program. And for our videos, set of videos here, which is about Ruby, you should know that Ruby is an interpreted language, which means you need an interpreter to run it and it's executed line by line. So our steps in creating an interpretive program, and in another video will actually show these steps in compared to compiled programming, is you create your program, you write it and whatever you know word processor; you shouldn't actually use a word processor, but text editor, and we'll talk about that in the tools section of the videos, and then you execute it using the interpreter. Generally you'll write the interpreter name and then the name of the program that you've just written, the name of the file, and you run it, and then the interpreter will eventually interpret your program for the computer. Now in the case of our little program I've been using here, we step through it and we go we go, if we act like the interpreter, we feed it in there and the interpreter says, Oh, print ple this. So it has to convert this into an instruction that's going to print something to the screen, and it converts this into the right kind of, um, information for the computer to understand that it's a string, we'll talk about those types in other videos, and then it actually does it. So it goes through multiple steps each time it hits a line converting it, figuring out what these different parts are, then actually creating the machine level code to execute the thing. And that's how it proceeds through, step by step. If it hits something it'll jump back. And, ah, I'm glossing over some complexities here, because it isn't that straightforward, but the basic, basics of the idea of what I'm pointing out here. Now a compiled language, which Ruby is not, it's interpreted, an example one would be C, and C is quite an old language, and it's a compiled language, and the steps for that are you enter the program, and again in a text editor, or whatever, using the particular syntax of that language. You feed that program to the compiler, the compiler creates object code, which is binary form on that program. Then you have to do something called linking it, which actually tells the computer, the microprocessor, where particular instructions are, so you have to link it to other parts of ah, essentially the operating system, how to print, when it makes a call to that print statement; it has to be able to know where to jump to, to execute that instruction, and that's what the act of linking does. Now, a compiled program is going to end up, if you go in and look at it with a text editor, is going to look like this. You will see all the code just like this. An interpretive program never ends up in a state like this. You, you can't look at an interpretive program like this, I guess you could try to capture somehow that process when it's running, but you'll never see a file like this from an interpretive program.

Tutorial Information

Course: Programming With Ruby
Author: Al Anderson
SKU: 33788
ISBN: 1-934743-01-1
Release Date: 2007-08-21
Duration: 8.5 hrs / 113 lessons
Work Files: Yes
Captions: For Online University members only
Compatibility: Vista/XP/2000, OS X, Linux
QuickTime 7, Flash 8

VTC Sign up & Benefits

  • Unlimited Access
  • 81,350 Video Tutorials (20,800 free)
  • Video Available as Flash or QuickTime
  • Over 782 Courses
  • $30 for One Month Access
  • Multi-User Discounts Available