SitePoint Sponsor

User Tag List

Page 1 of 4 1234 LastLast
Results 1 to 25 of 94

Hybrid View

  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
    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.

  6. #6
    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 13:31.
    Hello World

  7. #7
    SitePoint Evangelist CapitalWebHost's Avatar
    Join Date
    Apr 2003
    Location
    Albany, NY
    Posts
    417
    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
    Hostpc.com has Ruby support.

  8. #8
    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

  9. #9
    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.

  10. #10
    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.

  11. #11
    SitePoint Evangelist CapitalWebHost's Avatar
    Join Date
    Apr 2003
    Location
    Albany, NY
    Posts
    417
    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

    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
    I remember hearing the same thing from Perl programmers about PHP.

  12. #12
    SitePoint Wizard Dangermouse's Avatar
    Join Date
    Oct 2003
    Posts
    1,024
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by CapitalWebHost
    I remember hearing the same thing from Perl programmers about PHP.

  13. #13
    SitePoint Member
    Join Date
    Oct 2004
    Location
    Fairfax, Virginia
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dr Livingston
    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 agree. While Ruby sure looks "interesting", I can't see myself actually using it for a real project anytime soon. Python is just so unbeatably elegant and productive in its syntax, contrary to the initial impressions of so many C (and C-variant) programmers.

    I have grown to love the whitespace syntax of Python; you don't need those stupid curly braces, you don't need "begin" and/or "end" statements, you don't need semicolons; you don't need anything but one space. IMO, that's as easy as it gets, and people tend to indent anyway when they code, so it's that much easier.

    I'm not sure if anyone here realizes this (or has really acknowledged it), but Ruby's Python derivation is incredibly obvious when you look at even the easiest Ruby program; it uses "def" to signal function declarations, just as Python does; it uses "#" for comments, just as Python (and Perl) do; it intends to be as close to complete OOP as a language gets, just as Python does (although I think Ruby is trying too hard, sort of like they're trying just to prove something).

    I really like the idea of Rails, in theory, but as yet, it seems more a toy than anything worth considering in a large production environment. Then again, everyone has their biases; mine happens to be Python, coincidentally (or not) the language from which Ruby derives much of its syntax and philosophy.

    Quote Originally Posted by Dr Livingston
    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
    Yeah, at this point, I really can't tell if Ruby is here to stay, or if it's one of those fads that quietly fades away out of the limelight before it's ever really big.

    Regarding PHP, well, let's just say I can't stand 99.9% of the PHP code I've seen, whether it was official PHP.net examples, other people's projects, or even my own. All of the code just looks so inelegant and forced; I can't even begin to fathom the hundreds of the built-in functions that I see so often in PHP "applications". I think PHP is at the point where it's becoming bloated; it's trying to cram in every little feature imaginable into its own function, and this PHP 5 OOP stuff is just scary. It's as though this little scripting language is trying to compete with Java. It's even more so if you've read the history of PHP and its developers' original intentions.

  14. #14
    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 SniperDevil
    although I think Ruby is trying too hard, sort of like they're trying just to prove something
    Although your post is inflammatory, I do agree with this point: the biggest difference between Ruby and Python is not in the features of the languages, but the philosophy that drives them. Ruby takes objects, and lets you program procedurally with them, eg 1 + 2 rather than 1.add(2), while Python builds objects ontop of a procedural foundation.

    Quote Originally Posted by SniperDevil
    you don't need semicolons; you don't need anything but one space
    Not quite true, you do need an extra colon:

    Code:
    def my_function():
      # do something
    vs
    Code:
    def my_function()
      # do something
    end
    Personally I'd rather neither, this seems to be all you need:

    Code:
    def my_function()
      # do something
    Quote Originally Posted by SniperDevil
    at this point, I really can't tell if Ruby is here to stay, or if it's one of those fads that quietly fades away out of the limelight before it's ever really big.
    Ruby and Python are both more than a decade old, I think they'll both be around this time next year, don't worry about that

    Douglas
    Hello World

  15. #15
    SitePoint Member
    Join Date
    Oct 2004
    Location
    Fairfax, Virginia
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DougBTX
    Although your post is inflammatory, I do agree with this point: the biggest difference between Ruby and Python is not in the features of the languages, but the philosophy that drives them. Ruby takes objects, and lets you program procedurally with them, eg 1 + 2 rather than 1.add(2), while Python builds objects ontop of a procedural foundation.
    First of all, how is my post inflammatory? I don't see that, but I doubt you said that for no reason.

    Programming must be procedural; after all, you have to tell the computer what to do with the objects you've created, even if it's using objects' methods procedurally.

    I don't quite understand what you're saying about Python building objects on top of a procedural foundation; perhaps you can explain that a bit.

    Quote Originally Posted by DougBTX
    Not quite true, you do need an extra colon:
    Notice that I didn't say "colon", but "semicolon". Granted, you do need the colon to mark the beginning of the code block, but whitespace, rather than semicolons and braces, is primarily used.

    Quote Originally Posted by DougBTX
    Ruby and Python are both more than a decade old, I think they'll both be around this time next year, don't worry about that
    I understand that they are both more than a decade old -- though Python is, in fact, two years older than Ruby -- but I was simply pointing out that it is quite obvious which is more popular and which has a more established reputation, if nothing else; many people haven't even heard of Ruby. They'll both probably be around for a long time to come, but I don't foresee Ruby surpassing Python in popularity or reputation anytime soon.

  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 SniperDevil
    First of all, how is my post inflammatory? I don't see that, but I doubt you said that for no reason.
    You seem to argue that Ruby was a Python clone: Ruby takes from more than just Python A tiny bit of history here if you're interested.

    Quote Originally Posted by SniperDevil
    Programming must be procedural; after all, you have to tell the computer what to do with the objects you've created, even if it's using objects' methods procedurally.
    Well, that's really what I was getting at. Do you take a set of functions, and join them together to make objects, or do you take a set of objects, and send messages between them? At a high level you can ask these questions, at a low level everything is going through the a processor (or two).

    Sorry for nitpicking the syntax in your post like that, it sort of got in the way of the more interseting question of language design

    Douglas
    Hello World

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

    Quote Originally Posted by SniperDevil
    Regarding PHP, well, let's just say I can't stand 99.9% of the PHP code I've seen,
    We've recently been recoding a mostly Perl back end with Ruby. Some parts of the code are needed in both Ruby and PHP and so I've been witness to an interesting comparison between the languages.

    As far as conciseness is concerned, OO Perl just sucks. The ruby files as a group are about a third to a fifth of the size of the Perl originals. Note that I am talking only about OO perl here, not straight script code which is about equivalent. This is with all of the package, the ISA array, blessing and so on, so Perl 5 not Perl 6. Interesting is that the PHP versions don't come out that much larger than the Ruby ones.

    We have two identically functional pieces and one is about a third larger and the other only a few percent. That said our Ruby skills are not great. A few more blocks and fancy metaclassing hacks might reduce things further. In readability it's two votes to PHP over Ruby and one undecided (a mainly Java developer).

    One thing so far unmentioned. Ruby is a real amalgum of different languages: Perl, CLU, C, Smalltalk to name just a few (there are probably others I haven't recognised). This means that I don't feel I have learned much from it. The languages that have had a real impact are ones that have been, well not pure exactly, but committed to a way of doing things. For example Prolog, Haskell, C, C++ and even PHP. There is no shock value in Ruby.

    Ruby is above all a pragmatic workhorse it seems.

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

  18. #18
    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?

  19. #19
    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

  20. #20
    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

  21. #21
    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.

  22. #22
    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.

  23. #23
    SitePoint Zealot
    Join Date
    Oct 2001
    Location
    Norway
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Ryan Wray
    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

    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).
    Maybe that is a little outdated. Since Python 2.2, everything subclasses a builtin object type so you can subclass builtin types just as you can subclass your own classes.

    Code:
    class User
      include Singleton
      attr_accessor :name, :email
    end
    Here is one thing I don't like about Ruby (since learning Python I have become a little fanatical about this). That end keyword is just noise, the indentation says everything you need to know.

    I don't mean to say that Ruby isn't a great language, it's just that the best feature of Python is the whitespace sensitivity so curly brackets and end keywords are not needed. And that leads to cleaner,more readable code and less typing.
    I'd probably prefer Ruby over going back to PHP though.
    Good web hosting info All you need to know about web hosting
    xhbml(web dev blog)
    CSS Viking CSS blog

  24. #24
    SitePoint Addict
    Join Date
    Jan 2005
    Location
    Ireland
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by fish
    Here is one thing I don't like about Ruby (since learning Python I have become a little fanatical about this). That end keyword is just noise, the indentation says everything you need to know.
    I agree here. I much prefer to use braces than type 'end'. Better let, use indention only. Though, I must say, I remember a time when I used to hate the idea of relying on white-space.

    Good Luck

  25. #25
    ********* 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


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
  •