Video: RubyLet'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.
- Where to go from here
Viewers: in countries Watching now:
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.
- Writing source code
- Understanding compiled and interpreted languages
- Requesting input
- Working with numbers, characters, strings, and operators
- Writing conditional code
- Making the code modular
- Writing loops
- Finding patterns in strings
- Working with arrays and collections
- Adopting a programming style
- Reading and writing to various locations
- Managing memory usage
- Learning about other languages
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.
Find answers to the most frequently asked questions about Foundations of Programming: Fundamentals .
Here are the FAQs that matched your search "" :
- Q: Using TextEdit with Mac OS 10.9 Mavericks?
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.