Domain: rubycentral.com
Stories and comments across the archive that link to rubycentral.com.
Comments · 128
-
Re:PHP functions
Yeah, it's a bit ugly having a flat namespace of, let's see;
-<freaky@voi:~/src/phpdoc/en/functions>-
-% grep '<refentry id="function\.' *.xml |wc -l
2579
2579 functions.
Although I can see the argument for having all the compiled-in extensions loaded all the time, having absolutely everything in the same namespace makes writing procedural code a little dangerous, not to mention leaving a nasty taste in your mouth if you're trying to code in an OO fasion.
The answer is, of course, to put your functions in a seperate namespace (a class in Zend 1, a proper namespace in Zend 2), or to use a naming scheme that's less likely to conflict (personally I use WordCaps (or camelCase) instead of under_scores, but since PHP doesn't stick to under_score style all the time and isn't case sensitive, this isn't a wonderful solution).
Coding in an OO fasion's less an issue for namespace conflicts, and more an issue for getting procedural code thrown in everywhere unless you load performance draining wrappers. PHP's weak object model doesn't help here. After using Ruby I find myself running into PHP's limits a lot harder. *grumble*
I hope that they will move extensions to make use of namespaces sometime (PHP 5, or 6 maybe); i.e. MySQL::connect(), PgSQL::connect(), etc. If nothing else this will help make the language cleaner.
BTW, as for CPAN, some of the PHP bods are trying to produce something like it; PEAR, which includes a passable database abstraction layer, among other things.
Personally, I'd be using Ruby if it had better webserver embeddability (mod_ruby doesn't yet support Apache 2, and the Apache 1 support feels a bit immature) and a nicer CGI API. Running it as a daemon might be an interesting solution, but finding hosts who will allow that might be a bit of a pain. Maybe I should try it out while I can :) -
Re:cygwin!
> python even has gui bindings for windows
I'm not sure about native Win32 GUI stuff, but Ruby certainly has some pretty decent OLE support.
There's also support for native DLL API calls, and a free downloadable book (Programming Ruby).
The syntax is nice and clean and the object model is lovely. The C API is rather good too; C/ObjC/C++ extensions often end up looking rather like Ruby.
You can grab Win32 binaries from http://www.pragmaticprogrammer.com/, which includes a nice selection of bundled modules. -
Re:cygwin!
> python even has gui bindings for windows
I'm not sure about native Win32 GUI stuff, but Ruby certainly has some pretty decent OLE support.
There's also support for native DLL API calls, and a free downloadable book (Programming Ruby).
The syntax is nice and clean and the object model is lovely. The C API is rather good too; C/ObjC/C++ extensions often end up looking rather like Ruby.
You can grab Win32 binaries from http://www.pragmaticprogrammer.com/, which includes a nice selection of bundled modules. -
Re:cygwin!
> python even has gui bindings for windows
I'm not sure about native Win32 GUI stuff, but Ruby certainly has some pretty decent OLE support.
There's also support for native DLL API calls, and a free downloadable book (Programming Ruby).
The syntax is nice and clean and the object model is lovely. The C API is rather good too; C/ObjC/C++ extensions often end up looking rather like Ruby.
You can grab Win32 binaries from http://www.pragmaticprogrammer.com/, which includes a nice selection of bundled modules. -
Yet another poorly communicated language...
I looked at Ruby. It is certainly a heartfelt attempt. However, it seems to me that yet another poor communicator has written yet another language.
Not only that, but the Ruby creator has created his own syntax. A new language has one big advantage for the creator: The creator finds the syntax very familiar. Everyone else must struggle.
Links:
The Ruby Home Page
Ruby Language Reference Manual
The Ruby Language FAQ
Programming in the Ruby language by Joshua D. Drake, who is a good communicator.
A Slashdot story and comments: Programming in the Ruby Language
Positive comments about Ruby:
Introducing the latest open source gem from Japan
Thirty-seven Reasons I Love Ruby by Hal Fulton.
Negative comments about Ruby:
As mentioned above, Bruce Eckel does not like Ruby:
"IMO, the Ruby syntax is ... often annoying... Ruby requires more typing for no particular reason, and has an uninspired choice of syntax ..."
Eckel again: "... Python has 10 years behind it and a big, very smart, very active community, a nice number of good books and more on the way, a large set of libraries and a whole process and team in place for developing the language. Recent improvements to the language have outstripped whatever Ruby could offer, I think, and there's currently lots of very good work going on to further improve Python."
For those who would like to quickly see for themselves, there is a section of the The Ruby Language FAQ called Show me some Ruby code
Quotes from Ruby's creator, a Japanese man with an incomplete command of English:
What is the history of Ruby?
"Well, Ruby was born on February 24 1993. I was talking with my colleague about the possibility of an object-oriented scripting language. I knew Perl (Perl4, not Perl5), but I didn't like it really, because it had smell of toy language (it still has). The object-oriented scripting language seemed very promising.
"I knew Python then. But I didn't like it, because I didn't think it was a true object-oriented language -- OO features appeared to be add-on to the language. As a language manic and OO fan for 15 years, I really wanted a genuine object-oriented, easy-to-use scripting language. I looked for, but couldn't find one.
"So, I decided to make it. It took several months to make the interpreter run. I put it the features I love to have in my language, such as iterators, exception handling, garbage collection.
"Then, I reorganized the features of Perl into a class library, and implemented them. I posted Ruby 0.95 to the Japanese domestic newsgroups in Dec. 1995.
"Since then, highly active mailing lists have been established and web pages formed."
--
Links to respected news sources show how U.S. government policy contributed to terrorism: What should be the Response to Violence? -
Yet another poorly communicated language...
I looked at Ruby. It is certainly a heartfelt attempt. However, it seems to me that yet another poor communicator has written yet another language.
Not only that, but the Ruby creator has created his own syntax. A new language has one big advantage for the creator: The creator finds the syntax very familiar. Everyone else must struggle.
Links:
The Ruby Home Page
Ruby Language Reference Manual
The Ruby Language FAQ
Programming in the Ruby language by Joshua D. Drake, who is a good communicator.
A Slashdot story and comments: Programming in the Ruby Language
Positive comments about Ruby:
Introducing the latest open source gem from Japan
Thirty-seven Reasons I Love Ruby by Hal Fulton.
Negative comments about Ruby:
As mentioned above, Bruce Eckel does not like Ruby:
"IMO, the Ruby syntax is ... often annoying... Ruby requires more typing for no particular reason, and has an uninspired choice of syntax ..."
Eckel again: "... Python has 10 years behind it and a big, very smart, very active community, a nice number of good books and more on the way, a large set of libraries and a whole process and team in place for developing the language. Recent improvements to the language have outstripped whatever Ruby could offer, I think, and there's currently lots of very good work going on to further improve Python."
For those who would like to quickly see for themselves, there is a section of the The Ruby Language FAQ called Show me some Ruby code
Quotes from Ruby's creator, a Japanese man with an incomplete command of English:
What is the history of Ruby?
"Well, Ruby was born on February 24 1993. I was talking with my colleague about the possibility of an object-oriented scripting language. I knew Perl (Perl4, not Perl5), but I didn't like it really, because it had smell of toy language (it still has). The object-oriented scripting language seemed very promising.
"I knew Python then. But I didn't like it, because I didn't think it was a true object-oriented language -- OO features appeared to be add-on to the language. As a language manic and OO fan for 15 years, I really wanted a genuine object-oriented, easy-to-use scripting language. I looked for, but couldn't find one.
"So, I decided to make it. It took several months to make the interpreter run. I put it the features I love to have in my language, such as iterators, exception handling, garbage collection.
"Then, I reorganized the features of Perl into a class library, and implemented them. I posted Ruby 0.95 to the Japanese domestic newsgroups in Dec. 1995.
"Since then, highly active mailing lists have been established and web pages formed."
--
Links to respected news sources show how U.S. government policy contributed to terrorism: What should be the Response to Violence? -
Re:Anyone got a link?
Try the Ruby homepage here for downloads of the interperter.
Another good resource is for information about the language is Ruby Central, which includes the online version of the book, 'Programming Ruby - The Pragmatic Programmer's Guide' which is very use for those learing the language and as a general language reference.
-
Last year in EnglishActually Andy and Dave's book has been available for nearly a year. O'Reilly is scheduled to publish Ruby in a Nutshell this month, and Matz is scheduled to publish another English tome early next year. Sheesh, even Sams is getting into the picture soon apparently.
More interesting might be slides from last month's Ruby conference as well as a nice writeup with pictures. Wish I could've been there!
-
Check out this translated Japanese Ruby guide
This article is a good introduction, as advertised. The The Pragmatic Programmers Ruby Guide is an excellent book on Ruby as well.. but for a really nice book on Ruby, go to Ruby User's Guide. It is a translated book from Japanese, and since the Japanese had Ruby 7 years before we even heard about it, it out to be good.
-
Re:Horrible articlePython is considered by many to be the most elegant language even designed.
It's certainly cleaner than perl, and I like it and use it heavily, but elegant? Private attributes are created by prepending a double underscore, which is then mangled so that __foo becomes __Classname__foo. A number of features seem to be afterthoughts like that.
Significant indentation has some advantages, but it also leads to kludginess. Compare generating code in Lisp, with generating code in python. (How would you generate code for a new method and add it to a class, anyway?) Try un-mangling a python program that has suffered tab damage. Try cutting and pasting code, and having to shift it manually because no auto-indent mode is possible.
Python is more elegant than perl, and did a lot of things right. It's got plenty of quirks and kludges, though. Ruby isn't perfect either, but the more I've read of the Programming Ruby book, the more I've appreciated the coherence of the design. As other people have pointed out, you'd miss most of the important points in favor of Ruby if you just go by the article that prompted this thread.
OTOH, the availability of libraries and example code is inversely proportional to elegance: perl has the most, python next, and ruby the least. Often that overrides any other considerations.
-
The Pragmatic Programmers Ruby Book is Online
here.
-
Ruby is easy to learnI am a first year computer science student. While I have dabbled in C in the past, I am a newbie programmer.
It took me one day to learn ruby, using the online version of the excellent book Programming Ruby.
The next day I wrote a program to log in to a website, extract some information and email it to me. While that might not seem like a great achievement, it was the first time I had ever used hashes, iterators (which is definitely a cool feature of ruby), exceptions, http or cookies.
I was able to do this because ruby makes it so easy. Things tend to work the way you expect them to.
I would expect that if you have already used Perl or Python, you will find ruby even easier to learn.
Some other posters have mentioned the lack of "community support". I find the people on comp.lang.ruby to be extraordinarily helpful, with the creator of ruby (Matz) and one of the authors of Programming Ruby (Dave) often helping people with their problems.
-
Re:PythonWhile I do like Ruby, it doesn't have the support behind it that Python does.
I mainly use Perl, but have written a few utils in Python just to get a feel for the language. I've got to say, while Python appeals aesthetically, I can write anything an order of magnitude quicker in Perl (thought familiarity is doubtlessly an issue here.)
Ruby is, IMHO, even more attractive than Python for its more thoroughgoing object orientation, for example in Python you would write:
foo = "HeLLo"
import string
bar = string.swapcase(foo)Whereas Ruby treats foo as an object with its own methods from the word go:
foo = "HeLLo"
bar = foo.reverse()Add to this other goodies like block iterators and Ruby is looking very good.
What would stop me using Ruby is firstly the relative lack of maturity. (Though for some it would be an attraction to get into a language at the ground storey). And secondly the relative (and related) lack of Ruby programmers. The fact that Ruby can be written in a dialect that can be easily understood by Python (and even Perl) programmers, mitigates against this to some extent.
I'm not sure about support, but the availability of a free on-line text Programing Ruby (you can also but the hard copy), and a discussion group at Ruby Garden might go some way to alleviating your fears in that regard.
All in all Ruby looks like one of the nicest little scripting languages around -- Smalltalk meets Perl meets Python -- and I wish it the best of luck. With a bit of maturity I might even consider applying it in a production environment.
-
Because Ruby Rocks! :-)I don't really know anything about Ruby; perhaps it provides something which Perl and/or Python simply can't.
Yes, it does.
A Few Things I like about Ruby, by Joshua Haberman
- Everything is an object. Seriously. Even if you're not an all-out OO hippie, it gives great consistency:
> 65.chr
"A"
> "hello".length
5
> [1, 2, 3].last.to_s
"3" - variable punctuation determines scope, not type-- '@' is an instance variable, '@@' is a class variable, '$' is a global variable, and no prefix is local. This makes so much more sense than perl's confusing semantics ($foo[0] is part of @foo, but not $foo). It also lifts the ugliness of self.this and self.that. A constructor might look like this:
def initialize(foo, bar, baz)
@foo = foo
@bar = bar
@baz = baz
end
- Reading or writing from a class attribute is always a method call. I absolutely love this! It means you get the syntactic clarity of foo.bar = baz (no foo.getBar or foo.setBar), but the safety of hiding it behind a procedure. For example (this one is from The Ruby Book, in the chapter on classes):
class Song
def durationInMinutes
@duration/60.0 # force floating point
end
def durationInMinutes=(value)
@duration = (value*60).to_i
end
end
And now you can read to or write from someSong.durationInMinutes as if it were a simple attribute when in truth they're methods!
I'm not a Ruby expert, and I'm sure that some of these features can be found in other languages: my point is that people shouldn't just assume that Ruby is another Perl or Python, because it offers several advantages that differentiate it from Perl or Python. (and these are just a start: it features iterators, blocks-as-arguments, threads, and more)
However I completely agree that not having something like CPAN is a serious disadvantage in comparison to perl.
-- - Everything is an object. Seriously. Even if you're not an all-out OO hippie, it gives great consistency:
-
From Java to Ruby
In my case, I came to Ruby from the Java world. A friend forwarded me an email announcing the release of the Programming Ruby book and so I decided to check out the language. Since I enjoy learning about new programming languages I wasn't agaist learning "yet another language." A search on Google yielded the main Ruby-lang web-site, and after some reading I decided it was worthwhile to take the time to really learn it. That was about 4 months ago.
Since then, I've read through the on-line version of Programming Ruby as well as the printed version, which I recommend very highly. It is one of the best computer language books I have ever read (and I have a Computer Engineering degree.) I have also gotten very good at programming Ruby after only a month and half of serious study. In fact, I'm probably as good (or better) at programming Ruby as I am in Java (which I've been using for 3 years.) Now that is impressive. Of course I will admit I've been somewhat obsessive with Ruby and have studied it very extensively over this last month and a half, so your mileage may vary. But still: 3 years versus 1.5 months? Hmmm....
Of course I can't say the same wouldn't happen if I seriously studied Perl or Python, but I will say I don't intend to learn those languages now. They are fine and dandy for what they do, but just like all those out there who don't want to switch to Ruby since they know Perl (or Python), I don't want to switch to them because I know Ruby. So given that, I can probably respect those who decide not to learn Ruby for this reason.
But I have heard other Ruby users who have used Perl or Python say it is an improvement to them in some ways, so it may actually be worthwhile to at least take an hour or so to give Ruby a good look. I would say the same for Java programmers. If you've never touched a so called "scripting language", learning Ruby will change how you think about programming permanently. I'm sure former Java users now using Perl or Python could say the same thing. Of course Ruby is much more than a scripting language. In fact, I really wish I could just totally stop programming Java and just use Ruby (since it can solve the same problems), but I really don't think that is possible now since Ruby is so new (to the United States.) And of course Java is pretty much the corporate mantra these days.
But in the long run I could certainly forsee Ruby replacing Java in the enterprise. In fact, I think this should in some way unite Perl, Python and Ruby users, since we have a "common enemy" in Java, heh. Of course Java has it's uses too I suppose. And before Java advocates flame me, consider that I hold this view after 3 years of being a Java advocate and switching to Ruby for about 1.5 months (as noted above.) That's how much better I think Ruby is compared to Java.
Now other complaints about Ruby usually revolve around it's newness:
- It's doesn't have a big library like Perl's CPAN.
- No one uses it.
- I can't get paid to use it.
- I don't know it and won't learn it.
So, to conclude, at least give Ruby a chance and try not to be so fanatical about programming languages
:)
--
Ryan -
because..
- I already know a language, and it is perfect.
- I don't have time to learn something new.
- Someone once told me that a friend of theirs knew someone whose uncle said it was slow.
- It's new.
So, a couple of years from now, we'll probably see Slashdot readers saying "but I already know Ruby, why should I switch to xxxx?".
In the meantime, the book Programming Ruby is available online. Maybe it's worth a look. You can download Ruby from ruby-lang. Maybe it's worth a play. You never know...
-
Give it time
I think as long as it's use is based on it's usefullness (which has been the case with most scripting languages), it's only a matter of time.
Ruby has been as much of a pleasent surprise to me as Perl was back when I first learned it. No, it's not "Perl with Objects"; Perl itself does that quite well. It's more like Smalltalk, only readable, pragmatic rather than idealistic, and as expressive and concise as Perl when you want it to be. Personally, i think Ruby is a much greater threat to Perl than Python is, in the long run. Rather than forcing you to do it Guido's Way, you can do it the Perl Way, or the Smalltalk Way, or the Functional Way... or any combination of the above. No wonder the Pragmatic Programmers wrote a book on it. It does TMTOWTDI better than Perl does TMTOWTDI; while remaining relatively simple and clean.
So just give it time. I think it's well on it's way to world domination.
Oh, and as for a CPAN-like code archive for Ruby, there's a somewhat embrionic one here. There is discussion currently going on at the RubyWiki on how to implement a CPAN-like system for Ruby only avoiding the problems that CPAN has.
-- -
Ruby ResourcesRuby is fairly new to the English speaking community, but there are some good resources for it. Dave Thomas and Andy Hunt (authors of the "Programatic Programmer") have been doing a great job of promotting it and getting the information out to all of us non-Japanese speaking programmers.
Here's some references
...DDJ's January Article on Ruby (Thomas and Hunt)
Ruby Presentation (Thomas and Hunt)
Programming in Ruby Book (Thomas and Hunt. Available from Addison Wesley, online version is under an open content license)
And some web pages
...
-
Ruby ResourcesRuby is fairly new to the English speaking community, but there are some good resources for it. Dave Thomas and Andy Hunt (authors of the "Programatic Programmer") have been doing a great job of promotting it and getting the information out to all of us non-Japanese speaking programmers.
Here's some references
...DDJ's January Article on Ruby (Thomas and Hunt)
Ruby Presentation (Thomas and Hunt)
Programming in Ruby Book (Thomas and Hunt. Available from Addison Wesley, online version is under an open content license)
And some web pages
...
-
Ruby!
Seriously. It has the pure OO-approach and lambdas of Smalltalk, simplicity of Python, flexibility of Perl, even borrows mix-ins (advanced OO concept sort of like multiple inheritance) from eiffel and is fun, with easy to understand syntax! If you're going to teach OO language approaches in an imperative language, this is a serious language that contains just what you need and no extra fluff. It is easily extendable, both in C and within the language itself. I bought the "bible", got productive after a few hours and learned almost everything but C-extensions in just 3-4 days. Very easy and fun read, plus the entire book is also available online.
Here are some additional links:
The official Ruby page
Dr. Dobbs article about Ruby
Documentation
HotLinks
If this weren't MUCH better than Java, I wouldn't pull this shameless plug. Please check it out, don't stay in the dark ages.. ;-) Java is NOT a well-designed language. It's not always best to follow the pack either, those who make a difference don't. Ruby is perfect for bringing up new ideas. Let students experiment with extending OO-concepts in the language!
Btw, PLEASE don't make the students create Object Oriented ZOOs and the like. We were forced to such meaningless assignments when we had OO-classes in school, and such stupid problems are for OO-morons. Additionally, you don't need a "fast" language for teaching OO-concepts. On the contrary, since ruby is a glue language (like perl), it can be used to glue the right tools for the job when you need it to. It's definately fast enough if you just express your ideas in it correctly (avoiding many nested loops). Some people even use Ruby as a specification language, because of it's easy-to-understand syntax and lambdas. Ruby code is usually shorter and more readable than the same code expressed in other languages.
- Steeltoe -
Re:Cool things about Ruby..
So maybe you should listen to those experts when they say that *if* you took the trouble to specify a particular integer size other than the largest available you probably mean for it to stay that size.
Neither I nor the original poster (Offtopic aka(joekharris@NOSPAM.hotmail.com)) said that if programmers specified a particular integer size, Ruby should ignore it. Even I don't need experts to tell me what would be correct behaviour in this case.
AFAIK, by default integers in Ruby have unlimited size and the poster is just talking about how that is implemented. The reference book has more details. So I don't know why you'd want something that's supposed to be unlimited in size to be limited.
So just use bignums, not automatically-promoting small integers. Your numbers will just be numbers, and you'll never have a problem.
Why not let the language handle the conversion automatically, whilst I just treat them as numbers? If the language can seamlessly run faster when the numbers are small, but still handle big numbers why not let it do that?It's as convenient as having an automatic transmission in your car. No need to shift manually. That's one of the reasons why I use those sort of high level languages.
Cheerio,
Link. -
Ruby Book is Open Sourced Online
The Ruby book has been open sourced and can be read online here. You can also access XML and HTML sources for your own dabbling pleasure.
-
Take a look at this Ruby TutorialHere's some code examples Ruby Class Tutorial.
Ok, I was intrigued, but now I'm hopelessly non-impressed. What language uses '>>' as a comment, whilst using '> is a C++ construct.
I'll stick to LISP - Thanks
:)Winton
-
If this is true, then it's worth a new languageRuby weaves the best features of the best programming languages into a seamless, concise whole.
Ruby puts the fun back into programming. When was the last time you had fun writing a program---a program that worked the first time; a program that you could read next week, next month, or next year and still understand exactly what it does?
Other reasons for why this is good for us is here.
-
Learn RubyI'm currently learning Ruby, and MAN is that a beautiful OO-language. My only nit-pick about it so far is that it is not constrained enough, contains a few non-intuitive wrinkles and ambiguities, and don't really treat code as data (as Lisp do). However, I'm certain that it can either be extended (in runtime) to become more constrained (types, const, real protected object methods and variables, private/protected inheritance etc), or its going to develop a standard set of- or arbitrary concepts of constraints.
For RAD Ruby is a clear-cut winner. You have many high level concepts available in the language or the accompanying library (which is almost the same, since it's true OO). The most important and visible: each. No more for (i=sz; --i >= 0; ). Its also got lamdas, closures and eval. If there are some concepts missing in the language, it's usually possible to extend the language and reuse that extension again and again. At no cost of readabilty as in Forth. Oh, and did I mention everything is an object?
Whatever you can do in Python, Perl or Smalltalk, you can do in Ruby (as a language at least). The accompanying libraries are pretty sweet too. Try it, you'll like it.
- Steeltoe -
Speaking of languages...
This is pretty off-topic but, what the heck.
People interested in a very cool, completely object-oriented, beautiful, powerful language should check out ruby.
I think that ruby's clean syntax and pure object orientation outclasses (is this a word?) perl and python easily.
And, for anyone interested in learning, Dave Thomas and Andy Hunt (who wrote The Pragmatic Programmer, a book that all programmers should read) have written a book about ruby and placed it under the Open Publication License.
-
Re:Computer Animation/Visual FX doing this for yea
I have been breathing perl for to long of time...
Sure... Python's a language that seems to get along well with others. =^)
maybe I should look at this python beast...Can a python play nice with veggies and penguins?
Personally, though, I've settled on Ruby. It delivers on clean, simple reuse and has a flexible and very object-oriented syntax that agrees with my Perl-addled sensibilities. Have a look at the very nice introductory book which is now available online.
Of course, I still do one-liners in Perl...
-
1067 pages
Not surprising, since Perl is going the way of VB and becoming a bloated, hard-to-read language best suited for writing completely unmaintainable, uncomprehensible code.
Most people are moving to Python or Ruby, which are proving to be far more readable, extensible, and flexible languages than Perl.
Don't get me wrong--I used to be a Perl zealot, until the amount of crap that Perl adopted just sickened me to the point where I had to leave my first love and find something else that would be much more suitable to what Perl used to be perfect for... *sigh*