SitePoint Sponsor

User Tag List

Page 1 of 4 1234 LastLast
Results 1 to 25 of 94
  1. #1
    Resident Java Hater
    Join Date
    Jul 2004
    Location
    Gerodieville Central, UK
    Posts
    446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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.

  2. #2
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

    +1 for Ruby
    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.

  3. #3
    Resident Java Hater
    Join Date
    Jul 2004
    Location
    Gerodieville Central, UK
    Posts
    446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  4. #4
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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
    Hello World

  5. #5
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry about this, and I know it's going to hurt but I'm not really interested in Ruby folks. Sure, it's had a lot of positive press recently but I just don't know what all the noise is about.

    I know PHP really well, I have a good idea on Java and Swing, and now I'm more interested in Python, so I'm happy enough with this lot

    I think that once all the recent hype has burnt away, you'll proberly be left scratching your head and asking yourself, WTF, just like myself

  6. #6
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dr Livingston
    Sorry about this, and I know it's going to hurt but I'm not really interested in Ruby folks. Sure, it's had a lot of positive press recently but I just don't know what all the noise is about.

    I know PHP really well, I have a good idea on Java and Swing, and now I'm more interested in Python, so I'm happy enough with this lot
    Ruby is not whitespace sensative and you do not have to constantly pass a refernce to the object itself to methods. Seems like two strikes against Python when compared to Ruby to me.

  7. #7
    SitePoint Wizard
    Join Date
    May 2003
    Location
    Berlin, Germany
    Posts
    1,829
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Probably neither the right forum nor thread for this, but is anyone using JSP for webprojects?

  8. #8
    SitePoint Wizard REMIYA's Avatar
    Join Date
    May 2005
    Posts
    1,351
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why Ruby

    I haven't heard anything not good nor bad for this language.

    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.

    Not and Ruby, I think

  9. #9
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Seems like two strikes against Python when compared to Ruby to me.
    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

  10. #10
    SitePoint Addict n0other's Avatar
    Join Date
    Feb 2005
    Posts
    290
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, knowing additional language never hurts, but I don't find ruby as a language I would need. PHP, Python, trying to move to Java. I think thats just enough for a web programmer.

  11. #11
    SitePoint Addict
    Join Date
    Jan 2005
    Location
    Ireland
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sweatje
    Ruby is not whitespace sensative...
    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.

  12. #12
    SitePoint Zealot
    Join Date
    Jul 2004
    Location
    Oklahoma
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DougBTX
    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.

  13. #13
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Sgarissta
    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

    One of the top results for "PHP5 Singleton":

    PHP Code:
    Class User {
      static private 
    $instance;
      private 
    $_name;
      private 
    $_email;

      private function 
    __construct() {
      
      }

      static function 
    instance() {
        if(!
    Self::$instance) {
          
    Self::$instance = new User();
        } else {
          return 
    Self::$instance
        
    }
      }

      public function 
    name($name) {
        if(!
    $name) {
          return 
    $this->_name;
        } else {
          
    $this->_name $name;
        }
      }

      public function 
    email($email) {
        if(!
    $email) {
          return 
    $this->_email;
        } else {
          
    $this->_email $email;
        }
      }

    The same in Ruby:

    Code:
    class User
      include Singleton
      attr_accessor :name, :email
    end
    That's why I like Ruby

    Douglas
    Last edited by DougBTX; Jun 6, 2005 at 14:31.
    Hello World

  14. #14
    SitePoint Addict
    Join Date
    Jan 2005
    Location
    Ireland
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  15. #15
    ********* Victim lastcraft's Avatar
    Join Date
    Apr 2003
    Location
    London
    Posts
    2,423
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi.

    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.

    yours, Marcus
    Marcus Baker
    Testing: SimpleTest, Cgreen, Fakemail
    Other: Phemto dependency injector
    Books: PHP in Action, 97 things

  16. #16
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by lastcraft
    You could write a library in PHP which allows...
    PHP Code:
    MyClass extends Singleton { } 
    You could write this...

    Code:
    class MyClass < SingletonBase
    ...but would you want to?

    The real magic is that the Ruby example uses mixins and code generation without the developer jumping through hoops.

    Also Matz was not a native English speaker, so you have the similarily named class, module and klass.
    Note that 'klass' is just a convention for the name of a variable which holds the name of a class, it isn't part of the language. I've seen it in Java and Python, I don't know where it started first.

    Douglas
    Hello World

  17. #17
    Resident Java Hater
    Join Date
    Jul 2004
    Location
    Gerodieville Central, UK
    Posts
    446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  18. #18
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MiiJaySung
    5.times {print "*" }
    Code:
    puts '-' * 5


    Edit: Interesting page: http://www.levenez.com/lang/history.html

    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.
    Last edited by DougBTX; Jun 6, 2005 at 17:49.
    Hello World

  19. #19
    SitePoint Zealot
    Join Date
    Mar 2004
    Location
    Australia
    Posts
    101
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

    Wei.

  20. #20
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wei
    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.
    When I first saw something like that in a tutorial, I had an "aah... that makes sense, why don't other languages do this??" reaction

    Douglas
    Hello World

  21. #21
    SitePoint Wizard REMIYA's Avatar
    Join Date
    May 2005
    Posts
    1,351
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In what way can Ruby help a developer?

    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?

  22. #22
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by REMIYA
    In what way can Ruby help a developer?
    It expands your horizons

    Quote Originally Posted by REMIYA
    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:

    Code:
    #!/usr/bin/ruby -I/home/sweatje/rubylib/
    require 'ampoci8' #custom library to create the amp_oci8 factory method
    
    conn = amp_oci8;
    
    rs = conn.exec('SELECT EIM_IF_LDR_NAME, IF_BATCH_NUM, IFB_FILENAME 
    from X_AMP_EIM_JOB_INFO
    order by IF_BATCH_NUM ASC');
    
    rs.get_array.each {
      |row|
      tables = `grep "TABLE =" siebel_ifb/#{row['IFB_FILENAME']}`
      match = tables.scan(/TABLE =\s*(.*?)\r?\n/)
    
      print "#{row['IF_BATCH_NUM']}, #{row['EIM_IF_LDR_NAME']}, #{row['IFB_FILENAME']}, \"#{match.join(',')}\"\n" 
    }
    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).

  23. #23
    SitePoint Evangelist ghurtado's Avatar
    Join Date
    Sep 2003
    Location
    Wixom, Michigan
    Posts
    591
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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
    Garcia

  24. #24
    Resident Java Hater
    Join Date
    Jul 2004
    Location
    Gerodieville Central, UK
    Posts
    446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by REMIYA
    In what way can Ruby help a developer?

    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.

  25. #25
    SitePoint Wizard REMIYA's Avatar
    Join Date
    May 2005
    Posts
    1,351
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MiiJaySung
    Ruby is a scripting language.
    Which browsers have built-in functionality to run ruby script, or if it is not browser run, which servers are enabled by default?

    Excuse me, if the question is a kind of stupid, but Ruby is still a blackhole to me, and I'm trying to fill the abyss of ignorance


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •