The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

How many people here are using Ruby?...

I know this is not exactly the right forum, but it seems like all the Ruby users on this site seem to hang out on this forum as opposed to the other languages forum (well when I search for Ruby 80% of the results point here as most Ruby coders here seem to be the rebellious PHP programmer type). Anyway if the admins wanna move this after a while, I won't be offended. i just thought I'd post here initially as it would be seen by more relevant people who use the language.

Anyway, I'm just curious to hear what other people's expereince with Ruby is. It seems a number of people here are starting to use it, and it would be nice to know how people find it compared to their expereince with PHP. How many people do find it more productive / enjoyable to use, and what gottchas have people found. I've been skimming over some Ruby sites recently, just to investigate what there is to offer in the Ruby communitity. One thing that concerns me is the what the support is for 3rd party extensions, such as GD, FTP, DOM/xPath, cURL, etc. PHP has a very mature set of binding to other libraries. What have other people's experiences been with needing to use 3rd party extensions in Ruby, as they are probably less mature than PHP.

Also, other than Rails, have people looked at other frameworks? Everyone has hopped on to the Rails bandwagon (or should I say gravy train!). Have other people looked at frameworks like Borges. I like the sound of Borges, it seems to follow in the footsteps / concepts that Java's Cocoon framework uses of continuations (I haven't done anything more than skim the initial docs for it). I dislike cocoon because obviously it's a heavy weight solution because it uses a Javascript framework written in Java with bindings to bring the languages together (a VM running inside another VM is just taking the biscuit in terms of overhead imho).

How do a lot of projects like Wiki / CMS systems workout like. One things with PHP is that there is no way you can expect to take a package like Postnuke and expect to create a bespoke soltuion from it due to the amount of hacking involved. Have people found it easy to take existing Ruby solutions/packages and customise/tweak them so they meet the requirements of clients should they have specific requirements. There seem to a be a few nice little Rails apps developing out there, and ideally it would be nice to see how easy it to piece together existing projects to rapidly develop custom web apps.

In the last few days I've invested some time in skimming over Rubyforge and the rails site + Ruby docs to familarize myself with the language and projects. We are tempted to start using Ruby at work for new projects as I do find myself hitting the head against the wall with PHP a bit. I'm going to install a few apps/gems during the week and have a crack at doing some coding in Ruby too before I do anything serious. However, I also wanna know what other peoples experiences with the language have been beofre we rush into anything, and maybe see what advantages and gottchas other people have had.

Also, it would be interesting to see how many people are starting to use Ruby. Maybe if there are a number of people, it would be an idea to get a forum setup here for Ruby seeing as this is a popular web programming site. It might help develop a bigger Ruby community.

I have taken a few baby steps. I like the syntax of ruby, have worked to ensure I can talk to Oracle databases and have made a few small shell scripts. I have not yet had an opportunity to focus on a web project with it.

As for frameworks, despite the hype around rails, I don't think it will be the best fit for my usage (mainly becuase it is so MySQL centric, and I tend to use Oracle at work and Postgres at home). I am thinking I may investigate Nitro and IOWA as other alternatives.

Yea, I saw IOWA and Nitro, but sort of overloooked them having seen Rails. I must admit, I'm not too keen on Rails being too MySQL centric. I guess people have used it with PostgreSQL (I think I've seen some mentioning of it here and there). I want to move away of MySQL and get into using PostgreSQL in the long run.

Certainly, at the moment I would like to investigate how easy it is to plaster together pieces of Ruby such as Rails apps (i.e. Wiki's, and CMS type apps written on top of rails) to see how easy it is to take some of the out of the box applications and alter them and intergrate them into bespoke sites. It seems like Ruby apps are well coded from this point of view and Ruby will gain brownie points if I can slap together / scaffold sites like this, as this is one of the biggest weaknesses / pitfalls with PHP, which is probably due to a lack of disipline in the PHP community.

The only pitfall I've had is host support, I can only think of two which have built in Rails support. I've only tried one of the two, and experience has been great

Of your list of 3rd party libs, the only one I've used in Ruby is FTP, which comes in the standard library, see the docs for Net::FTP at http://www.ruby-doc.org/stdlib/

Some of the things you can do with Ruby you just wouldn't think of doing with PHP. For example, I was playing with some of the card quizes (there is a quiz every Friday on the Ruby-talk ML) and I made my pack of cards by extending the number class. So I could do this:

Let's look at the following languages: C, C++, Java, JavaScript, PHP. If you know one of them it is extremely easy to learn the others, because the syntax is very clear and they have many things in common.

That's not the point I for one, have only a given amount of time in any week to put towards learning a new technology or langauge. Just that Python got my attention first Jason, why I'm not really interested in learning Ruby.

Also, even though Rails for Ruby looks good, I'm not yet totally convinced

I've grown to like the neccessity of whitespace in Python programs. While at first I hated it, I now like the fact that it promotes readibility and a uniformed coding style - some might feel supressed, but it comes to me as a welcome relief from PHP programmers ugly styling. Most programmers indent their code by similar standards anyway, so what is the problem?

That said, I don't have any experience in Ruby, but I think it is about time I look at it - if nothing more.

The only pitfall I've had is host support, I can only think of two which have built in Rails support. I've only tried one of the two, and experience has been great

Of your list of 3rd party libs, the only one I've used in Ruby is FTP, which comes in the standard library, see the docs for Net::FTP at http://www.ruby-doc.org/stdlib/

Some of the things you can do with Ruby you just wouldn't think of doing with PHP. For example, I was playing with some of the card quizes (there is a quiz every Friday on the Ruby-talk ML) and I made my pack of cards by extending the number class. So I could do this:

Code:

card = 3
card.black? #=> true
card.name #=> "3 of Clubs"

Douglas

Ruby's Object Model is pretty incredible, and is definitely THE selling point of the language. Like most others who have posted, I've tinkered with Ruby, and have written several small scripts and libraries, but have not had a chance to do any major work in it. I think it's an impressive language, with a great community, and lots of potential! I certainly look forward to seeing how Ruby progresses.

Ruby's Object Model is pretty incredible, and is definitely THE selling point of the language. Like most others who have posted, I've tinkered with Ruby, and have written several small scripts and libraries, but have not had a chance to do any major work in it. I think it's an impressive language, with a great community, and lots of potential! I certainly look forward to seeing how Ruby progresses.

The was a bit of back and forth argument on the Ruby-Talk ML recently by someone trying to model the whole Ruby OM in UML. Ruby didn't fit

I've grown to like the neccessity of whitespace in Python programs. While at first I hated it, I now like the fact that it promotes readibility and a uniformed coding style - some might feel supressed, but it comes to me as a welcome relief from PHP programmers ugly styling.

Moving to Ruby from PHP felt to me much like moving from HTML to XHTML/CSS. I found a group of people who liked the same formatting and naming styles as me

Unrelated, but anyone who has interests in languages like Python, here is a good comparission between Python vs. Ruby: http://www.rubygarden.org/faq/entry/show/14. My very brief look at Ruby so far and I myself do not really like some of the shared charestics between Perl and Ruby, but at the some time it has some things I like more than Python:

Ruby’s OO purity provides a number features that Python lacks or is still working toward: a unified type/class hierarchy, metaclasses, the ability to subclass everything, and uniform method invocation (none of this len() is a function but items() is a method rubbish)

I remember when I was first experimenting with Python (which is pretty much all I have done in Python) and being suprissed that string.len() was actually not valid, but I had to len(string) (ie. len is a __builtin__ function). Ruby looks like it has definetly a better OO model, so I will definetly look more into the language.

We are using Ruby as a Perl replacement and gradually phasing out Perl. We are not planning it as a replacement for PHP in the web arena though. PHP is a pain to run as a command line tool, not least because you have to reset your memeory limit in the php.ini everytime you want to run a script. Ruby also has threads.

The upside for PHP is that it is easier to learn and read. With PHP 5, it also goes on a different path than ruby as it starts to borrow some typing rules from Java. There are also a lot more libraries. PHP seems to be faster even on the command line (I haven't compared web performance).

Ruby has a very powerful and flexible object model with the mixins. You can use Javascript and AOP like tricks of adding methods to objects at run time. Ruby has threads (no use in a web environment) and fewer, but better quality libraries.

That singleton example is a bit of a cheat though, because the singleton module is built in. You could write a library in PHP which allows...

PHP Code:

MyClass extends Singleton { }

Ruby has some irritations, although nowhere near as many as PHP. Libraries are inconsistently capitalised and DB support is poor to say the least. Also Matz was not a native English speaker, so you have the similarily named class, module and klass. A wider vocabulary would have helped here I think. Ruby is sometimes different just to be different. It also has some perlisms, although this disease is in no way as bad as in PHP.

In general though it's a great language. If you are using Python then it's so similar that it's not worth learning both. If you come from a Java/C++/C# background then you should definitely give it a try.

As for people don't see the point in learning Ruby, well fair enough. Personally, I think it's worth a quick stab at everything to find out what's good and bad, likewise it's good to read what other have to say about things like on this thread as it can be a time saver.

Like many here, I only have a limited amount of time I can put towards learning new things, however it seems like the gain in picking up Ruby could out weigh the amount of time I get hitting my head against the wall with dirty looking PHP code.

As for the inconsistency issue Marcus mentioned, personally I wouldn't be fussed about that too much in the odd instances where it crops up, well not seeing as I code mainly in PHP and occasionally tinker with C++, languages where consistency is known to be servely lacking in places!

What sells ruby to me is the expressiveness of the language. Like Doug was pointing out, and examples it gives in the manual like the 5.times {print "*" } seems so much more logical to for ($i = 5; $i--; ) echo "*";. I have to be daring and argue against Marcus in the case against PHP being more readable and easier to learn. Admittedly, I've used a petitte example above, but certainly Ruby is more readable once you understand the language. I wouldn't say there is much difference in terms of learning curve and to some degree readablity (I know a lot of coders like to use Perl like short cuts can sometimes make things slightly less readable, much like a ternary operator does)

The other thing that makes ruby appealing to me is that you can use it for slap-up GUI apps as it has binding to various UI libraries. I know PHP has PHP GTK, but no one touches that, and as Marcus stated, the ablity to support some form of primitive threading means that a lot more can be done with the language from this point of view.

Certainly hosting is not an problem for me, having dedicated servers mean that installing Ruby should be a walk in the park

Take a look at 1990-1995. Three languages pop up which are combinations of 3 or more previous languages. Java, Python and Ruby.

Probably more interesting for me because I wasn't coding back then, but nice to see the history. It has Ruby comming from Smalltalk, CLU, Perl, and Python, which itself comes from Modula (never heard of that), ABC and C. That's quite a lineage. (PHP is just a sub-branch of Perl on that diagram...)

Java and Ruby strike me as opposite views of OOP, the only ancestor they share on that diagram is Smalltalk.

I have used Watir (written in Ruby) for some web unit testing, though works with IE only. The language constructs are quite different. Coming from more c/java/php style syntax, ruby was quite difficult to read at the begining, "where are my curly braces??". An editor that ables to highlight ruby syntax really helped. The object model in ruby is quite impressive compared to my experiences with java/php/javascript object models. Everything in ruby is an object.

A wonderful tool, a must try, is the "irb" (interactive ruby?). To see what

Code:

puts '-' * 5

does
run irb on a command prompt, enter, "puts '-' * 5", and see the results.

Does it have a GUI? Or is it command line tool like C, C++, and working with external GUI libraries?

Can Ruby be used as a scripting language?

Ruby is an interpreted language, so the primary use is scripting. There is a tool called irb which is an interactive command line version of the language you can use for developing quick scripts. There is another tool called ri (ruby info) which is the ruby API documentation.

Here was an example I used today. I needed to query a table, find a file name based on one column, and grep for a line in the file, and display a comma separated list of the combined output. Here was the code:

Initially it might look a little funny, especially if you are only familiar with PHP syntax, but it really quick to put together scripts like this and I feel Ruby's syntax has an elegance to it that PHP lacks (this may be in part becuase of a "benevolent dictator" type design rather than PHP's more evolutionary growth).

I have only just began to get my feet wet with Ruby a few months ago. I have not used it in any "official" client work, but I have created a couple simple apps just for fun.

Ruby is such a self explanatory language, that the best to learn about its features is by using it, preferably along with a helpful tutorial. For a very lighthearted, extraordinarily creative and very entertaining way to learn Ruby, I highly reccommend checking out Why's Poignant Guide to Ruby

Does it have a GUI? Or is it command line tool like C, C++, and working with external GUI libraries?

Can Ruby be used as a scripting language?

from what I've seen of it, Ruby seems to make sense and you are not writing scaffold code to support / make up for a lack of features offered by the language, so you sepend more time trying to solve the problem and not waste time solving issues regarding the language. Once you get your head round the syntax it is quite logical and intutative it seems.

Ruby, like PHP has no "GUI". I wouldn't say C/C++ are command line tools either (There are lots of IDE's out there). jEdit makes a good Ruby editor as it highlights source. This is sort of needed really to make it easy to read if you are very used to C/C#/C++/PHP/Java. It is quite obvious to see Ruby's roots in Perl and Smalltalk syntax wise

Ruby has bindings to a number of GUI API's like Cocoa, wxWidgets, Fox GUI Lib, and SDL.

Ruby is a scripting language. Hence why I posted here as it is sort of similar to PHP in terms of it's target audience.