Programming Defined / The Art of Programming Pt.3
Subtitles of the Movie
In this video we're going to take a look a little bit more at the art of programming and how it ties in to Ruby a little bit more. So, the first thing I'm going to do is create a Java program that's just going to print out "hello" here. And, I'm not doing this to diss Java or anything. I, I'm actually doing this to show you the differences between Java and Ruby. And, like I said in the first Art of Programming Video, each of these technologies has their place. But I feel that when it comes to creativity that Ruby allows you express a little bit more and I really want to highlight and show you why I believe that. So, let's let's go ahead and create this. So, I'm gonna do a public class and we'll just call it hello. And we get our parentheses and we need to have a public static, void, main and string, orgs and let's open that up and we'll just say, system out print line in hello. And this isn't even, I mean this'll, this will compile up okay. So here we go. Um, go ahead and run it. Actually, I messed up on the name here. Okay. There we go. And compile it and see if we, okay. So we run it and it says hello. Nothing too complex but it's, it's fairly daunting looking, and when you're learning programming all this stuff gets kind of in the way; all these different things. Like I said, Java has its place. I'm not saying it doesn't, and it has a lot of strengths. But let's do a new Ruby one. There you go. So, I just wanted to kind of show you the difference there between the two. Now, if I did C, or something along those lines, it, it would have a closer look to something along these lines, but, it'd be complex. However, if I went to Perl, or another type of scripting language it would look closer to what's going on here. Now, obviously, there's a lot of stuff going on behind the, the screen, so to speak, with Ruby. It isn't just as easy. But for a programmer, especially starting out, it is just this easy and you don't have to worry about all that added complexity that's here. The thing with these languages such as Java is they give you an incredible amount of power to do things and they have a lot of flexibility but that comes with a price and the price is that, uh, declarative language like this that's pretty strictly typed, you have to spell it out for the compiler. You have to tell it the scope of the class and, and if these words don't mean anything to you don't worry about it, we'll get to them eventually in other videos. You have to tell it what you're talking about here along with the name. You have to declare the various strings and the types of the arguments that you're going to use, and, and when you're using methods they have to be spelled out so the compiler can find them. So, and, and there's these little language constructs that have to, to end the line and you need a semi-colon, and to close out you need the braces and they're required. Now Ruby has similar things but they're, in some ways, they're not required. You could use parentheses down here wouldn't really make too much difference. But as a programmer it might clarify things up if this was a complex statement. But as far as Ruby's concerned, it doesn't really care, you don't want to be putting semi-colons and stuff in here, you're going to get; well, it, it worked with that, you could put them in there, but you really don't want to get in the habit of adding extra stuff that you don't want in there. So, really, Ruby let's you be creative because you can start at these very simple terms just putting in some simple commands and really expanding your understanding from there. Now, in another video, early video, we're going to cover algorithms, because another component to programming, as I talked in the earlier Art of Programming Video, the first one, is you have to know what you're going to solve, the problem that you're going to solve, and you have to figure out how you're going to solve it. Not only are you choosing your technology like Java versus Ruby versus C, or whatever, but you also then have to pick your approach and a lot of programming has to do with, the actual act of programming, has to do with algorithms. And algorithms are the logic how a problem is solved and I'll get into more in, in that video and that's kind of where were going here, but I wanted to show you how to be a little bit creative and, and show you the difference between Ruby and Java here. Now, just for a side thing, ah, the program I'm using here is called Text Mate, and it's just a text editor. It's a very nice text editor. There's plenty of good text editors out there. I like this one because it's got a lot of features; it understands if I'm dealing with a Ruby file versus a Java file versus some other type of file, and there is plenty of editors on the Windows Platform that have similar kind of aspect as well as Linux, and we'll get into development tools down the road of what you can use for these different things. This is just exposing you a little bit to Ruby and how you can kind of see the, how you can be creative with Ruby, just because of the simple syntax and what it allows you to do there.
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
United States 