Starting to know Ruby

Hi,

The other day surfing the internet I came across this tutorial about programming Ruby and after finishing reading it I immediately decided to by the book “Learn To Program” from The Pragmatic Bookshelf to see how different this language was and to my surprise the language is different and the syntax seems to be easer and cleaner, at least different than the languages I’m a little familiar with (Actionscript 3.0, a little JavaScript, and currently learning PHP).

The other good reason I see by learning this new language is that it could be used for the Web and to create desktop applications, I know that there is a lot of controversy about PHP frameworks vs Ruby on Rails but I’m planning on learning more about PHP as well since it’s a well known language and it cannot be ignored since its used on most of the CMS.

Sorry for making this too long but I just wanted to share my short experience with Ruby, now I need to ask a question.

I’m currently using the command line to execute the little programs that I have been practicing with and I was wondering what is needed if I would want to run (install) a program made with Ruby on a machine that doesn’t have Ruby installed? I know I would need Rails for the web but for desktop applications?

Do I need some sort of compiler?

How can I create buttons, text fields etc. for desktop applications?

Sorry I’m new to this language and to the programming world in general.

Thanks a lot

To execute ruby, you need a ruby interpreter. If the machine you want the program to run on doesn’t have a ruby interpreter, then you have to package up a ruby interpreter with your code.

With full service languages like ruby (v. php), you create gui applications, i.e. applications that open up windows with text boxes, buttons, etc., with one of the gui packages available for that language. Ruby, like other languages, has a variety of gui packages available including tk, wxruby, and shoes. However gui programming is an intermediate to advanced topic, so you will need a good grasp of a programming language before embarking on such a project. In ruby, shoes is kind of beginner level gui package with limited features, so you might want to take a look at that first.

Before you settle on ruby, I suggest you take a look at python. python has a web framework called Django as well as about 10 other frameworks that are similar to ruby on rails(ROR). And once again ROR is an advanced topic. You won’t have a clue what’s going on in ROR unless you have a good grasp of ruby first. In fact, I suggest you do some web programming without a big unwieldy framework first before trying to understand a framework. To do web programming, you need a good grasp of html, css, javascript, and one server side web programming language like php, ruby, python, or perl. I’ve studied 8 or so languages, and I think python is the best of them all.

ruby is a pretty crazy language that at a certain point becomes write only.

Thank you for your reply!

Hmm, so you think I would be better if I start learning Python?

Is Pytho a multi language like ruby that can be used for the web and for desktop applications?

Why wouldnt be a good time to start learning Ruby at this moment? Because of the little support?

Thanks

python is a full purpose language, just like ruby, perl, java, etc. python executes much faster than ruby, and the documentation is better. The ruby docs are pathetic. ruby kind of exploded in popularity with the web framework ruby on rails(ROR). However, it is a complex bloated piece of junk in my opinion.

If you’re just start learning a web framework, I’d go with Django. It’s a web framework for Python that’s catching more steam. I have found that I enjoy Django much better than Rails. Each has it’s own advantages/disadvantages.

Here’s the main page:
Django | The Web framework for perfectionists with deadlines

Link to install it:
Django | Quick install guide | Django documentation

And a few nice tutorials to get started:
Django | Writing your first Django app, part 1 | Django documentation

In the Ruby/Rails community you’re expected to learn by wading through API documentation – and we know how much fun that is. It’s great if you are putting up a blog post with a few simple tables. If it gets more complex than that, you’re going to hate life unless you are a Rails expert.

The main issue I have with Ruby/Rails is the GEM hell (akin to DLL hell) from having to include specific versions of GEMS and all the dependencies they require.

What I do think shines in Rails is the testing framework.

Another good point for python: it comes with a gui package called tk, i.e. after you get python installed, then you will have a gui package installed as well.

With ruby, you have to install a gui package yourself, which can be a pain. python takes the view that it’s better to provide a gui package with the installation than not. Of course, then python had to decide which gui package to include, which is an issue I guess ruby didn’t want to deal with.

Personally, I’ve decided the wx* gui packages are the best, e.g. wxpython and wxruby, so after experimenting with python’s tk gui package, I had to install wxpython myself, which I don’t remember being too much trouble. On the other hand, getting wxruby installed took a long time–like a year. I couldn’t get wxruby to work, so I gave up, and then about a year later I tried again, and once again I couldn’t get it to work, so I went to the main ruby forum and vented my frustration, whereupon some extremely helpful peopl took on the challenge and stuck by me until I got wxruby to work.

Thank you all very much!