SitePoint Sponsor |
|
User Tag List
Results 1 to 25 of 94
-
Jun 6, 2005, 05:24 #1
- 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.
-
Jun 6, 2005, 05:59 #2
- 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 RubyJason Sweat ZCE - jsweat_php@yahoo.com
Book: PHP Patterns
Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
Detestable (adjective): software that isn't testable.
-
Jun 6, 2005, 06:53 #3
- 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.
-
Jun 6, 2005, 07:14 #4
- 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"
DouglasHello World
-
Jun 6, 2005, 08:02 #5
- 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
-
Jun 6, 2005, 08:24 #6
- Join Date
- Jun 2003
- Location
- Iowa, USA
- Posts
- 3,749
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by Dr Livingston
-
Jun 6, 2005, 08:40 #7
- 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?
-
Jun 6, 2005, 08:47 #8
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
-
Jun 6, 2005, 11:33 #9
- 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.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
-
Jun 6, 2005, 12:35 #10
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.
-
Jun 6, 2005, 12:40 #11
- Join Date
- Jan 2005
- Location
- Ireland
- Posts
- 349
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by sweatje
That said, I don't have any experience in Ruby, but I think it is about time I look at it - if nothing more.
-
Jun 6, 2005, 12:58 #12
- Join Date
- Jul 2004
- Location
- Oklahoma
- Posts
- 119
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by DougBTX
-
Jun 6, 2005, 13:31 #13
- Join Date
- Nov 2001
- Location
- Bath, UK
- Posts
- 2,498
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by Sgarissta
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.
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;
}
}
}
Code:class User include Singleton attr_accessor :name, :email end
DouglasLast edited by DougBTX; Jun 6, 2005 at 14:31.
Hello World
-
Jun 6, 2005, 13:41 #14
- 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)
-
Jun 6, 2005, 14:18 #15
- 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 { }
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, MarcusMarcus Baker
Testing: SimpleTest, Cgreen, Fakemail
Other: Phemto dependency injector
Books: PHP in Action, 97 things
-
Jun 6, 2005, 14:51 #16
- Join Date
- Nov 2001
- Location
- Bath, UK
- Posts
- 2,498
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by lastcraft
Code:class MyClass < SingletonBase
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.
DouglasHello World
-
Jun 6, 2005, 16:22 #17
- 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
-
Jun 6, 2005, 16:31 #18
- Join Date
- Nov 2001
- Location
- Bath, UK
- Posts
- 2,498
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by MiiJaySung
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
-
Jun 6, 2005, 18:10 #19
- 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
run irb on a command prompt, enter, "puts '-' * 5", and see the results.
Wei.
-
Jun 6, 2005, 18:22 #20
- Join Date
- Nov 2001
- Location
- Bath, UK
- Posts
- 2,498
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by wei
DouglasHello World
-
Jun 6, 2005, 20:23 #21
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?
-
Jun 6, 2005, 20:47 #22
- Join Date
- Jun 2003
- Location
- Iowa, USA
- Posts
- 3,749
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by REMIYA
Originally Posted by REMIYA
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" }
-
Jun 6, 2005, 21:22 #23
- 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 RubyGarcia
-
Jun 7, 2005, 03:52 #24
- Join Date
- Jul 2004
- Location
- Gerodieville Central, UK
- Posts
- 446
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by REMIYA
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.
-
Jun 8, 2005, 16:33 #25
Originally Posted by MiiJaySung
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