Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
Finally, the course compares how code is written in several different languages, the libraries and frameworks that have grown around them, and the reasons to choose each one.
Let's take a look at one of the newer languages on the list, Ruby. This was developed in Japan in the mid 1990s and most people would consider it a very pure object oriented language. In Ruby everything is an object, even variables that might be considered primitives in other languages like Booleans or integers. Everything is an object. It's a high level garbage collected language. We don't really need to think about memory management and it's completely interpreted. We don't need a compiler for Ruby. We do need an interpreter.
It doesn't compile to intermediate language like Java or the .NET languages. Most people find it very easy to approach. There isn't a lot of prerequisite knowledge required to get started with Ruby. So it's fairly friendly for beginners. The question is what it used for? Well, it is a cross-platform language. There are installers and interpreters available on every OS and you'll actually find it built into the last few versions of Mac OS X. It's probably become most famous recently for it to use in what's called Ruby on Rails.
This is a web framework that uses the Ruby language. Aside from that it's a great language for writing small utilities, text processing applications on the desktop. So what does it look like? Well, it is not obviously a C based language. We don't need a main section. This would be considered an entire working Ruby program. Puts for put string "Hello, world! No semicolons at the end of the line, but this doesn't really tell us too much about it.
So I'll add a few more lines here. I'm going to define what we call a function here. I can see that we use comments, not with the two forward slashes, but with the pound sign or hash sign. And then creating this function or method here, I'm using the word def for define. We're calling this welcome saying it takes a parameter of name and then we're going to output hello comma, whatever the name is. We don't use curly braces to mark the end of the function. We use the word end instead and then below it I say x = bob.
This is how I'd create a variable which is a string and then I just call this function or method saying welcome and passing in x. Again, don't worry about memorizing syntax. The idea here is that you're just looking at the overall structure. Ruby is a fairly compact, fairly clean language to get started with. And if you're interested, what do you need? Well, not really a lot. If you're working on a Mac you already have the Ruby interpreter there. There are several different editors that you might use. TextMate and RubyMine on the Mac, Aptana is cross-platform.
There're quite a few that have Ruby support. Probably the most two important websites are rubyonrails.org, which is all about that web based framework that uses the Ruby language, and ruby-lang.org. Both of these have fantastic resources for getting started with Ruby, either the Ruby language by itself or as a web based framework.
There are currently no FAQs about Foundations of Programming: Fundamentals.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.