Domain: ruby-lang.org
Stories and comments across the archive that link to ruby-lang.org.
Comments · 349
-
Re:Disappointing
Love's slam of Microsoft on the patent front is somewhat unfair.
Bullshit. Your slam of Love is unfair. To-wit:
It wasn't Microsoft's to sue. It was Xerox'. ... Microsoft has not sued to prevent others using the Xerox windows GUI as apple did,Strike one.
sued to prevent extension of an 'open' language standard as Sun did,
Exqueeze me? Microsoft replaced several key calls with proprietary API of their own... violating their license agreement to use the Java trademark. You don't like it? Go write your own damn language, but if it doesn't meet standards, you can't call it "Java". That's not dirty pool, that's just fair.Microsoft never had to sue to prevent the bogus breaking of a language; they were the ones doing the bogus breaking. There's a difference in adding things to a language and breaking what's already there.
Strike two.
or steer standards bodies towards a technique they owned an undisclosed patent on.
Oh, yeah? Tell me Microsoft isn't behind RAND.Strike three called, on the outside corner. Go siddown, Casey.
They don't call it the Evil Empire for nothing.... and I don't care if you are a troll (obviously the moderators don't think so), the hoi polloi need setting straight. I don't hate Microsoft for their products. Some of them are actually decent. I hate Microsoft because they do, in fact, play dirty pool.
--
If there be any among us who would wish to dissolve the Union or to change its republican form, let them stand undisturbed as monuments of the safety with which error of opinion may be tolerated where reason is left free to combat it.
-- Thomas Jefferson, Inagural Address (I) -
Re:Perl 7
No, it'll look like this.
(Ruby) -
Stop Complaining!
If you've really only been programming in Lisp for a week or so then you really haven't had time enough to appreciate what its strengths and weaknesses are. It sounds to me as though you have acquired a disease that is all too common amongst programmers - the desire to want to specialise in one language too early on.
I simply cannot emphasise enough how valuable it is to learn as many programming languages as possible. Even if you don't really like it at first, a language can grow on you in ways you would have never imagined. No language is perfect, so knowing a selection of different languages will give you the opportunity to choose a tool that is appropriate to the job in hand. If the only tool you have is a hammer, then every problem you come across starts to look like a nail.
By keeping your horizons broad, most especially by learning languages that might seem strange, counter-intuitive or even downright annoying at first, I can assure you othat you will become a much, much better programmer in the long run. The ways in which languages differ can often give you an insight into the ways that different programmers might solve the same problem.
FWIW, the presence of closures and eval are not the only things that make Lisp distinctive from other languages. The one truly unique (not to mention incredibly powerful) feature of Lisp is macros. You will not be able to find these in Perl. Also, in Perl the standard way to solve problems is with an iterative, procedural style, where Lisp more often employs recursion and an applicative programming style, both of which are techniques well worth the effort to learn about.
Whether Lisp is better than Perl for AI is debatable. I'd argue in favour of Lisp for the following reasons: one is the fact that Lisp is extremely good at knowledge representation (and the subsequent manipulation of that knowledge), but more important is Lisp's ability to generate code with macros, effectively meaning that you can write programs to write other programs. It's also probably worth noting that Lisp is quite a lot faster than Perl, given a decent enough compiler. See The Programming Language Shootout if you don't believe me. Lisp is also a very mature language, with an ANSI standard, so unlike Perl you can be certain that it won't be pulling any carpets out from underneath your feet any time soon.
If I haven't done a enough good job of convincing you that learning Lisp is worthwhile (and I probably haven't) then try checking out Paul Graham's Beating the Averages. Also, be sure to check out Richard Gabriel's Good News, Bad News and How to Win Big. And have a read of Paradigms of Artificial Intelligence Programming by Peter Norvig for some more specific examples of Lisp as an AI programming language. Particularly relevant might be the section in the preface entitled Why Lisp?.
And when you're done with Lisp, I'd recommend a look at Ocaml, SML, Ruby and Smalltalk (particularly the delightful Squeak)! -
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.
-
Ruby Does It Right.This one post covers a number of topics raised in various submissions.
Support
There seems to be this opinion that Ruby lacks support or libraries. Ruby, being fairly young, does have fewer extensions than many languages, but it has enough. It comes with a TK interface, and extensions for GTK, QT, FOX, dialog, curses, and others are available. There are a couple of XML parsers, as well as both client and server libraries for XML-RPC. There are copious extensions for web-oriented programming, and a very nice DBI with extensions for most of the databases that I know of (including MySQL, Postgres, and Oracle). In all honesty, I can't think of an application that you write in Ruby with what's available. Besides, this argument was often used by Microsofties to support why you shouldn't use, well, anything but Windows.
Learning curve
Another common argument is the old "Can't use it... nobody knows it," also known as the programmer-hit-by-bus syndrome. Really, Ruby code is more readable than anything else I've ever seen, if you come from a C-ish background. It is just as alien as anything else if you come from a Lisp-ish background. A good example of this is that my own experience. I'm a professional Java programmer. About one work week after I started learning Ruby, I realized that all of the pseudo-code that I was writing on my white-board was valid (or nearly valid) Ruby code. Further, on one mini-project I was tasked with improving the speed of a 426-line bash shell script. I had never seen the script before in my life; the conversion to a valid Ruby program took about an hour; getting functional validity took another hour or so. I spent the of day optimizing and "Ruby-izing" the script, eventually getting a tenfold speed increase and dropping about 1/5 of the code. Ruby, IMO, has a very low learning curve, and given halfway decent code, I suspect that any programmer familiar with OO and any C or sh style language could understand the code.Syntactic Sugar
Ruby isn't unique in this regard, but it does have a lot of nice syntactic sugar. First, code isn't rigidly formatted like Python. Neither is is verbose, as one post suggested. I strongly suggest looking at the "What is Ruby?" and the "Compare Ruby to other languages" pages for more information. To quote those two pages here would be excessive. The comparison page compares Ruby to Perl, Python, Java, and TCL.
Why switch?
If you have a language you know and like, why switch? I can sympathize with this position. I've long felt that way about Java and other "upstart" languages, like Python. For me, there weren't any compelling reasons to switch. I've found Ruby to be the first language that does (almost) everything right. It may not have the wide array of extensions that other languages have, but the core language is designed properly. When you write code in Ruby, you write code to do the job, rather than writing code to support the code that you write to do the job. My favorite example is:
Java JButton button = new JButton("Click");
button.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent ae ) {
doClick();
}
});
which becomes
Ruby button = JButton.new("Click") { doClick() }Code is both terse and readable, and often elegant by virtue of the language syntax. It is easy to write good code in Ruby. This improves productivity and maintainability, and any time you can significantly improve these I'd say it is a good enough reason to switch.
True OO
This is a very strong argument in favor of Ruby. Everything truely is an object. I can't stress how much difference this makes in practice, and arguments to the effect that other languages that provide "work-arounds" for their non-OO types are arguments for hacks to fix flaws in the language design.
Lack of documentation
I'd argue that, while having a large library of documentation for Ruby might be nice, it isn't neccessary, and that this is a strength of the language. Really, all I have is one Ruby book, and that is sufficient to do anything I want. I have nearly 50 books on Java, and I need many of them. I'm not being absurd here; Ruby really is very simple. I'll agree that there is a minimum requirement for at least one good book, or at least, some good documentation, which Ruby didn't have until recently.
Too much diversity
Well, perhaps. But the idea is that with language development moving forward, you tend to get some progress in languages in general. I have known over a dozen computer languages, but I really only know two at the moment: Java, and Ruby. I use these because I believe that they are the pinnacles of their fields. I actually believe that Ruby could replace Java in my life, but I'll have to change jobs for that to happen... I don't get to choose what language I program in on my current job.
Scripting language
Ruby is an interpreted language, but I'd hesitate to call it a scripting language. Ruby certainly is suitable for large application development, and has all of the language features necessary for application development. It has classes, modules, includes, and mixins. That said, Ruby is also emminently suitable for scripting. I can easily write:
ls *.jpg | ruby -nalF. -e '`convert -geometry 320x240 #$_ #{$F[0]}_thumb.jpg`'or, from the Ruby man page:
ruby -p -i.bak -e '$_.upcase!' /tmp/junkAgain, an example of good design: everything in Ruby is OO, even if you aren't aware of it, as in a small script.
Summary
I'm a relative Ruby newby. I used to do Perl, I tried Python, I programmed in TCL for a while, and I do a lot of Java. I chose Ruby initially because I liked the look of the code and features of the language, and I've become an advocate because I've recognized that my productivity in Ruby is far greater than in any of the other languages I've tried. Ruby fits both the scripting niche, and the large application niche. I like Ruby precicely because it doesn't have any of the annoying features of other languages. So, why Ruby? Because it is better. Because it does things right.
-
Ruby Does It Right.This one post covers a number of topics raised in various submissions.
Support
There seems to be this opinion that Ruby lacks support or libraries. Ruby, being fairly young, does have fewer extensions than many languages, but it has enough. It comes with a TK interface, and extensions for GTK, QT, FOX, dialog, curses, and others are available. There are a couple of XML parsers, as well as both client and server libraries for XML-RPC. There are copious extensions for web-oriented programming, and a very nice DBI with extensions for most of the databases that I know of (including MySQL, Postgres, and Oracle). In all honesty, I can't think of an application that you write in Ruby with what's available. Besides, this argument was often used by Microsofties to support why you shouldn't use, well, anything but Windows.
Learning curve
Another common argument is the old "Can't use it... nobody knows it," also known as the programmer-hit-by-bus syndrome. Really, Ruby code is more readable than anything else I've ever seen, if you come from a C-ish background. It is just as alien as anything else if you come from a Lisp-ish background. A good example of this is that my own experience. I'm a professional Java programmer. About one work week after I started learning Ruby, I realized that all of the pseudo-code that I was writing on my white-board was valid (or nearly valid) Ruby code. Further, on one mini-project I was tasked with improving the speed of a 426-line bash shell script. I had never seen the script before in my life; the conversion to a valid Ruby program took about an hour; getting functional validity took another hour or so. I spent the of day optimizing and "Ruby-izing" the script, eventually getting a tenfold speed increase and dropping about 1/5 of the code. Ruby, IMO, has a very low learning curve, and given halfway decent code, I suspect that any programmer familiar with OO and any C or sh style language could understand the code.Syntactic Sugar
Ruby isn't unique in this regard, but it does have a lot of nice syntactic sugar. First, code isn't rigidly formatted like Python. Neither is is verbose, as one post suggested. I strongly suggest looking at the "What is Ruby?" and the "Compare Ruby to other languages" pages for more information. To quote those two pages here would be excessive. The comparison page compares Ruby to Perl, Python, Java, and TCL.
Why switch?
If you have a language you know and like, why switch? I can sympathize with this position. I've long felt that way about Java and other "upstart" languages, like Python. For me, there weren't any compelling reasons to switch. I've found Ruby to be the first language that does (almost) everything right. It may not have the wide array of extensions that other languages have, but the core language is designed properly. When you write code in Ruby, you write code to do the job, rather than writing code to support the code that you write to do the job. My favorite example is:
Java JButton button = new JButton("Click");
button.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent ae ) {
doClick();
}
});
which becomes
Ruby button = JButton.new("Click") { doClick() }Code is both terse and readable, and often elegant by virtue of the language syntax. It is easy to write good code in Ruby. This improves productivity and maintainability, and any time you can significantly improve these I'd say it is a good enough reason to switch.
True OO
This is a very strong argument in favor of Ruby. Everything truely is an object. I can't stress how much difference this makes in practice, and arguments to the effect that other languages that provide "work-arounds" for their non-OO types are arguments for hacks to fix flaws in the language design.
Lack of documentation
I'd argue that, while having a large library of documentation for Ruby might be nice, it isn't neccessary, and that this is a strength of the language. Really, all I have is one Ruby book, and that is sufficient to do anything I want. I have nearly 50 books on Java, and I need many of them. I'm not being absurd here; Ruby really is very simple. I'll agree that there is a minimum requirement for at least one good book, or at least, some good documentation, which Ruby didn't have until recently.
Too much diversity
Well, perhaps. But the idea is that with language development moving forward, you tend to get some progress in languages in general. I have known over a dozen computer languages, but I really only know two at the moment: Java, and Ruby. I use these because I believe that they are the pinnacles of their fields. I actually believe that Ruby could replace Java in my life, but I'll have to change jobs for that to happen... I don't get to choose what language I program in on my current job.
Scripting language
Ruby is an interpreted language, but I'd hesitate to call it a scripting language. Ruby certainly is suitable for large application development, and has all of the language features necessary for application development. It has classes, modules, includes, and mixins. That said, Ruby is also emminently suitable for scripting. I can easily write:
ls *.jpg | ruby -nalF. -e '`convert -geometry 320x240 #$_ #{$F[0]}_thumb.jpg`'or, from the Ruby man page:
ruby -p -i.bak -e '$_.upcase!' /tmp/junkAgain, an example of good design: everything in Ruby is OO, even if you aren't aware of it, as in a small script.
Summary
I'm a relative Ruby newby. I used to do Perl, I tried Python, I programmed in TCL for a while, and I do a lot of Java. I chose Ruby initially because I liked the look of the code and features of the language, and I've become an advocate because I've recognized that my productivity in Ruby is far greater than in any of the other languages I've tried. Ruby fits both the scripting niche, and the large application niche. I like Ruby precicely because it doesn't have any of the annoying features of other languages. So, why Ruby? Because it is better. Because it does things right.
-
Re:Because Ruby Rocks! :-)
As has been posted other places. There is a ruby equivalent to CPAN; it's called the Ruby Application Archive.
-
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.
-- -
Re:Python
Doctor Dobb's Journal
For more Ruby info, check out their homepage
-----
"Goose... Geese... Moose... MOOSE!?!?!" -
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
...
-
Re:XHTML + Ruby
XHTML 1.1 incorporates Ruby.
Yes, but not Ruby the scripting language that is sort of like python, but Ruby short runs of text along side the main text.
In answer to the orginal question, Ruby doesn't have a lot to offer over other scripting languages, and not long real has any big wins over python. (it closest relative) Python no has full fleged garbage collection and the Functional programing extenstion has closures, etc.
-
Japanese Free Software programmers
This is ridiculous. Take a look at this very short and very incomplete list of the Free Software that Japanese programmers have written or contributed to - it's nothing to be sneezed at:
- LAME: Takehiro Tominaga, Naoki Shibata, Iwasa Kazmi
- Linux Kernel SuperH port: Niibe Yutaka, Kazumoto Kojima
- Linux AWE32 driver, also various large parts of ALSA project: Takashi Iwai
- gcc: Nobuyuki Hikichi, Shigeya Suzuki, Masanobu Yuhara
- glibc: Isamu Hasegawa, Shinya Hanataka, Masahide Washizawa
- debian: Atsushi Kamoshida, Takao Kawamura, Takuo Kitame (have you seen how much Takuo is responsible for in Debian? if you use GTK+, Nautilus, Evolution, Mozilla or indeed pretty much anything GTK+/GNOME-related you're using his packages and their accompanying patches/fixes), Atsuhito Kohda, Sekido Koichi, Tomohiro Kubota, Shugo Maeda, Keita Maehara, Kikutani Makoto, Goto Masanori, Teruyuki Morimura, Ishikawa Mutsumi, Hayao Nakahara, Takashi Okamoto, Shuichi Oono, Susumu Osawa, Taketoshi Sano, Akira Tagoh, Nokubi Takatsugu, Yasuhiro Take, Uno Takeshi, Masato Taruishi, Junichi Uekawa, Fumitoshi Ukai, Akira Yamada, Yoshiaki Yanagihara, Araki Yasuhiro, Taku Yasui
- ruby: Do I even need to bother listing the names in the ruby credits? ruby, the most innovative and OOP-pure of the modern scripting languages, is almost entirely of Japanese origin - the who's who file is here.
And this is just a very short and very incomplete list that I knocked up in a few minutes.
Sorry, I don't buy this article at all. Granted, the PC has never taken off in Japan in quite the same way it has elsewhere in the world, but that's the price of having an already extremely wired and hi-tech population, something of a distrust of western domination of any one market (why do you think Linux is such a huge hit over there, with the now famous retail sales figures showing TurboLinux outselling Windows?), and also the debacle that is the Japanese PC98 specification. So, yes, perhaps given its size and technological level, Japan is not as well represented in the PC software world as it could be, but to suggest from that that Japanese programmers are no good is outrageous and smacks of the American cultural arrogance that the rest of the world is sick to the back teeth of. Note also the implication that because the Japanese shy away from Microsoft software, that this makes them somehow backward. Very disturbing that this is the prevailing view of a major media outlet such as The Economist.
Oh, and as for mainframes being out of date - tell that to IBM and all its customers using z390's to consolidate servers, and whose reliability and I/O performance wipe the floor with anything the PC industry could come up with now or in the next 15 years.
-
How to check Hotmail via POP3
A friend of mine got sick of our university's clunky email server, so he figured out (ok, reverse engineered) the HTTPMail protocol that Hotmail uses. He wrote a proxy server, initially in perl, and more recently in ruby, which allows you to point your mail client at your local machine and it will proxy requests to the HTTPmail server (i.e., Hotmail). It's OSS and hosted on SourceForge. Give it a try. It beats whining on
/. about not being about to use POP3. -
RubyOK, I'll toss the first charcoal briquette to start a language flame-war, it's a slow day on Slashdot
:-)I'd also recommend that you try Ruby. I think you could consider it the next generation after Perl and Python. Very clean, O-O language with regular expressions and closures. I wrote in Python for a while, including Zope, and ended up switching to Ruby. I'm using the Debian Ruby packages from "unstable", which work excellently.
Thanks
Bruce
-
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 -
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 -
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 -
Why hasn't Ruby taken off?
All my respects to Python, but I have to ask the same question about Ruby.
As you say, it's clean, fast, easy to extend, easy to code for. And there's no whitespace issues to balk at, even for 30 seconds (although there are legitimate reasons to balk at whitespace issues for more than 30 seconds).
I have used Perl almost extensively, and love it--Perl deserves all the use and attention it has--but when I think of something "cleaner" I'd like to use, my thoughts switch to Ruby, not Python.
In Ruby's case, though, I can probably say its age is why it hasn't moved further yet (at least in the U.S.;the first Ruby conference is this year). Ruby's acceptance has moved rather quickly when you think about it.
If you have been thinking about Python, and haven't taken a look at Ruby, *please* do. You'll probably like it. Ruby's too good to not at least check out.
-
The Perl6 answer could be ... RubyPerl has been my favorite language for some time now, even with all its warts. I've been keeping tabs on Perl6 stuff and thinking about how Perl could be improved. I finally surfed over to the Ruby site to check it out, since I heard that it was an attempt at a "better" Perl.
After playing with it for a while, I think it could be my new favorite language. My Ruby programs usually come out even more concise than Perl, but just as clean looking as Python.
Ruby needs more library support and some optimization work (I usually get about 4X slower than Perl), but I think that is an extremely promising contender in this space.
-
What I did so I could type again (long)In June of last year, I ran into a scary situation. After a long programming binge, I found myself unable to type for more then 20 minutes without having pain for the rest of the day. I had switched to a Natural Keyboard in 98 which let me off the hook for a while, but..
The pain around my knuckles and center of the top part of my hand got bad enough that I had to have an intern read/write e-mails for me at work. And rather then being a senior systems admin, I did staff training for various technical topics. Yippy. I took two weeks off of typing, and did a lot of research. This is what I ended up doing:
1) Kinesis Contour Keyboard . I was highly skeptical of this keyboard, being $250... but my hand pains were enough that I would try anything. I got it for home, the one with dual-dvorak/qwerty caps. I now swear by this keyboard so much that I would rather give up my Athlon and go back to a 486/33 if it was the only way to keep this keyboard. I then had work buy me one. It's hard to learn a new keyboard if it changes depending on where you are
:) The primary advantage of this keyboard is no matter what keys you hit, your hands never move. Things that don't move, don't get stressed. I've also got some good photos of it's inards and some closeups.2) Dvorak Keyboard Layout . I took the dive when I bought my Kinesis and immediately began learning Dvorak. Having my keyboard labeled with dual-dvorak/qwerty keys helped me a lot. Un-learning 12 years of QWERTY was by no means easy, but worth it. It was very rough to learn (took about 3 weeks to get back to normal speed), but because your fingers don't have to move as much for english words, my fingers are under a lot less stress. Doesn't help much with perl though, but Ruby's nicer syntax means my hands contort less anyways. Oh, you don't lose your qwerty skills. Whenever I type on a normal keyboard, my hand things qwerty. It associated Dvorak with the Kinesis keyboard.
3) Contour Systems Perfit Mouse . This was almost as important as the keyboard. It amazed me what a difference this made. These mice are custom to your hands. I got two 3-button mice for 7-inch hands, one lefty and one righty. I use the left handed mouse at home (my natural hand), and the right handed at work. It took some training on my right hand, but the balance makes it much less hurtful. I still get pains going to Microsoft mice or trackballs. I can't stress how excellently designed these are for your hands. Rather then pushing the end of your finger to click, you apply a very light pressure in the middle of your fingers. Less movement is less stress is less pain.
4) xwrits . This is software to remind you to take keyboard breaks. You can install it straight from
/usr/ports/deskutils/xwrits in FreeBSD. This is the .xsession command line I use:xwrits typetime=50 +finger=japanese +clock +mouse +beep +breakclock +multiply +top &
I'm going to have to set it so that locks me out of my workstation soon. I often will type "killall xwrits". Anyways, that's what I ended up doing for my situation. I can now type again quite happily, though I still get pains on normal qwerty keyboards like the one I'm on ATM at a friends house. Hand damage really sucks, I miss being able to use laptops without pain. Now I have to drag this Kinesis around.
IF YOU FEEL PAIN - STOP - TAKE BREAKS - FIX YOUR SITUATION! SEE A DOCTOR!. I cannot stress this enough. Not fixing this earlier has cost me.
-
Ruby
No one has mentioned embedded Ruby - probably because no one has heard about it. It's a fully object oriented scripting language somewhat like a cross between Smalltalk and Perl. There's mod_ruby project that's pretty far along. I'm not sure how it compares to ASP/JSP/PHP/Perl for execution, but it's sure a heck of a lot faster for development.
-- -
Re:Who wants to write CGI anyway ?
You can find out about mod_ruby here:
mod_ruby. -
But what is Ruby?
Ruby is an interpreted 'scripting' language for quit and easy object-oriented programming; it combines the pure object-orientation of Smalltalk with the power and convenience of Perl, and a simple, clean syntax inspired by Eiffel.
I would strongly recommend this book to anyone interested in Ruby. Its layout is clear and concise and it is well written. A great introduction to a fascinating language. In fact, I picked this book up about four months ago and haven't used Perl since:]
If you want a comprehensive online resource to all things Ruby, or are just curious, check out www.ruby-lang.org
-
Not Parrot, Ruby!
Besides from this probably being another April's Hack, this has already been done! And its called Ruby. Ruby takes all the good parts from Perl, Python, Java, and even Smalltalk and combine them in a genuine object oriented language which is suited for both quick hacks and larger projects. Read Thirty-seven reason I Love Ruby and What's Ruby. -
Not Parrot, Ruby!
Besides from this probably being another April's Hack, this has already been done! And its called Ruby. Ruby takes all the good parts from Perl, Python, Java, and even Smalltalk and combine them in a genuine object oriented language which is suited for both quick hacks and larger projects. Read Thirty-seven reason I Love Ruby and What's Ruby. -
On a more serious note...[Ruby]
Whilst this is a nice joke, a language which melds the best of smalltalk like languages and perl does exist - it is called Ruby. Ruby is very symetrical, neat and is taking over from perl in Japan.
-
take a look at ruby too
Ruby is similar to perl and python in many ways, but brings its own interesting ideas to the table. I find it to be a happy middle ground between perl and python. It's a truly object-oriented language, unlike perl or python, and comes ready for real work with a debugger, profiler, interactive shell and bindings for ldap, snmp, and mysql and postgres. Have a look at the ruby website. Rumor has is that an O'Reilly book is in the works.
-
Re:Python does kick ass
Heh. That's pretty neat, and I would definitely agree that Python looks cleaner than Perl. I've never used Python, and not written a great deal of Perl either, so my opinion is just that. However, since someone above mentioned my current favorite pet/hobby/braintease language Ruby, I thought I could at least give a Ruby version of the above example. Here goes:
0.upto(10, 2) { |x| puts x }
I think this is the "native" way to do this in Ruby, although I haven't been toying with it for very long, so I could be wrong. What happens is (roughly) that the message upto is sent to the object 0, with a code block associated with the call. If you're familiar with Smalltalk, this should be natural. The object 0 receives the message (aka "executes the method"), does the requested iteration, and calls the associated code block for each visited number. Pretty neat, huh? The availability of these very Smalltalk-esque code blocks, but coupled with a more familiar (and sane!) syntax is what attracted me to Ruby. Recommended. -
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...
-
Best OOP language I've encounteredIf you're interested in a language that simply is the best I've found out there, check out Ruby. Here's some nifty features cut'n pasted from the website:
Ruby has simple syntax, partially inspired by Eiffel and Ada.
All in all, a language that IMHO should replace Python and Perl.Ruby has exception handling features, like Java or Python, to make it easy to handle errors.
Ruby's operators are syntax sugar for the methods. You can redefine them easily.
Ruby is a complete, full, pure object oriented language: OOL. This means all data in Ruby is an object, not in the sense of Python or Perl, but in the sense of Smalltalk: no exceptions. Example: In Ruby, the number 1 is an instance of class Fixnum.
Ruby's OO is carefully designed to be both complete and open for improvements. Example: Ruby has the ability to add methods to a class, or even to an instance during runtime. So, if needed, an instance of one class *can* behave differently from other instances of the same class.
Ruby features single inheritance only, *on purpose*. But Ruby knows the concept of modules (called Categories in Objective-C). Modules are collections of methods. Every class can import a module and so gets all its methods for free. Some of us think that this is a much clearer way than multiple inheritance, which is complex, and not used very often compared with single inheritance (don't count C++ here, as it has often no other choice due to strong type checking!).
Ruby features true closures. Not just unnamed function, but with present variable bindings.
Ruby features blocks in its syntax (code surrounded by '{'
... '}' or 'do' ... 'end'). These blocks can be passed to methods, or converted into closures.Ruby features a true mark-and-sweep garbage collector. It works with all Ruby objects. You don't have to care about maintaining reference counts in extension libraries. This is better for your health.
;-)Writing C extensions in Ruby is easier than in Perl or Python, due partly to the garbage collector, and partly to the fine extension API. SWIG interface is also available.
Integers in Ruby can (and should) be used without counting their internal representation. There *are* small integers (instances of class Fixnum) and large integers (Bignum), but you need not worry over which one is used currently. If a value is small enough, an integer is a Fixnum, otherwise it is a Bignum. Conversion occurs automatically.
Ruby needs no variable declarations. It uses simple naming conventions to denote the scope of variables. Examples: simple 'var' = local variable, '@var' = instance variable, '$var' = global variable. So it is also not necessary to use a tiresome 'self.' prepended to every instance member.
Ruby can load extension libraries dynamically if an OS allows.
Ruby features OS independent threading. Thus, for all platforms on which Ruby runs, you also have multithreading, regardless of if the OS supports it or not, even on MS-DOS!
;-)Ruby is highly portable: it is developed mostly on Linux, but works on many types of UNIX, DOS, Windows 95/98/NT, Mac, BeOS, OS/2, etc.
- Steeltoe
-
There is no one true language . . .
. . . unless that language is Ruby
:-)
Seriously, I'd certainly agree that you need to use the right tool for the job, but it is important to consider the fact that some tools are a lot more useful than others!
----- -
Re:Why not SmallTalk?
Isn't that true of Ruby as well? Seems to me it's a language that might have more practical application, but that's just me.
-lx -
Re:I agree wholeheartedly
If you would only drink the koolaid and start using Ruby, none of these language wars would affect you.
:) -
Re:Quit yer bitching!
Any language with such a massive library so oriented to network programming would have this advantage.
One thing that nobody has mentioned, yet, is the huge size of the Java "standard library"
There are API's for doing everything under the Sun which is great news for developers.
Although any new language coming out in the past few years would have to be called braindead for not including a Regular Expression class.
(Maybe I've been corrupted by too much Perl, or Ruby ).
Steve
--- -
Have you heard of Ruby?The language Ruby is a fully object-oriented interpretive language with good regular expression support. It's inspired by Perl, but a good deal cleaner than Perl IMO. I'm afraid I've always had an esthetic problem with Perl. Unlike Python, Ruby's object model isn't an afterthought. Ruby is dual-licensed under the GPL and an Artistic-like license. What would be the Perl Conference in the U.S. is the Perl and Ruby Conference in Japan. Ruby's released implementation is interpreted, but there is an experimental JIT compiler. Packages for various libraries exist and it's shipped with Debian.
It seems to be a pretty nice language. Nobody here seems to have heard of it. Why? I think it needs a bigger community outside of Japan.
Thanks
Bruce
-
Re:good in a way, bad in a wayAlmost all languages are not based on C.
I don't like C/C++ as a language too, just that, when you have to know these to make a living today (and probably the next 5 years too), you don't have a choice.
I am completely for the idea of writing everything in a nice scripting language (my current favorite: Ruby, previously covered by Slashdot, with the exception for the OS, drivers, and games.
Back to Ruby: it has evolved to version 1.6.2, and has basically ALL characteristics of a nice programming language that I want. Some of them are:
- Although everything is an object, you don't have to create a class for a runnable program, unlike Java. (if you don't specify a class, then the code belongs to the object "main"). Everything can look like non-OO if you want it to.
- It adheres to the principle of Perl: there is more than 1 way to do things. However, its syntax resembles more like pseudocode of an algorithm. I'd say, power of Perl, readability of Python.
- Unlike Python, it actually has a keyword that terminates a scope, "end". So you aren't forced to indent if it is not necessary - sometimes indentation can make code less readable!
- Semicolons are optional.
- Rich control structures: break, retry, next...
- You can define your own iterators with very little code, since the iterator is cordial to this language.
- I have been disgusted by Java and Pascal's
try {... try {... } except {... } } finally {... }
WHY are there 2 block levels when you really need only 1? Ruby is beautiful in this aspect: begin ... rescue ... ensure ... endCheck it out.
-
why basic?
-
What about Ruby ?I believe it combines the expressiveness of Perl with the clarity of Python.
Ruby is easier to read than Perl because it has been designed as an OOP language from the grounds-up. You also won't see stuff like @{$foo->['bar']} (is that right ?) but instead Ruby uses simple naming conventions to denote the scope of variables. Examples: simple 'var' = local variable, '@var' = instance variable, '$var' = global variable.
And I prefer Ruby to Python because Ruby has assignment syntax sugar such as +=, -=, etc. and all data (including Integer, String, List, etc.) in Ruby are class instances.
Anyway, for a better overview of Ruby, look at: The Ruby Home Page
-
Re:Japanese Perl
-
Re:Japanese Perl
-
language?What would Perl be like if it was coded by a native Japanese speaker?
-
Japanesse Perl would look like Ruby!
You haven't heard of Ruby? (Or for you English speakers out there, Ruby) To quote the FAQ:
Ruby is a simple and powerful object-oriented programming language, created by Yukihiro Matsumoto (who goes by the handle "matz" in this document and on the mailing lists).
Ruby is pretty dammed cool--it borrows (or maybe even just plain steals) a lot from perl, but the OO support was designed in from the beginning.
-
Japanesse Perl would look like Ruby!
You haven't heard of Ruby? (Or for you English speakers out there, Ruby) To quote the FAQ:
Ruby is a simple and powerful object-oriented programming language, created by Yukihiro Matsumoto (who goes by the handle "matz" in this document and on the mailing lists).
Ruby is pretty dammed cool--it borrows (or maybe even just plain steals) a lot from perl, but the OO support was designed in from the beginning.
-
Ruby
If you want a real OO scripting language, pick Ruby www.ruby-lang.org, avoid C-like pike.
-
Ruby vs. Perl code shoot-out
I'm just starting to try Ruby out, and I haven't used it for anything big or important yet, but it seems to me that its main advantage is being rather more readable and probably more maintainable than Perl (which I still haven't stopped loving anyway...). Here is a small sample, lifted directly from the cgi.rb module:
def CGI::parse(query)
params = Hash.new([])
query.split(/[&;]/n).each do |pairs|
key, value = pairs.split('=',2).filter{|v| CGI::unescape(v) }
if params.has_key?(key)
params[key].push(value)
else
params[key] = [value]
end
end
params
end
Now, a more or less "literal" translation into Perl would look like this:
sub CGI::parse {
my $query = shift;
my %params;
foreach $pair (split(/[&;]/, $query)) {
my ($key,$value) = map { CGI::unescape(\$_) } split(/=/,$pair,2);
if (defined($params{$key}) {
push @{$params{$key}}, $value;
else {
$params{$key} = [$value];
}
}
%params;
}
Despite superficial differences, you are able to tell from this example that the strongest influence on Ruby has been Perl. The examples are essentially the same. Someone with a background in Perl (like myself) has a much easier time learning Ruby than, for instance, Python.
What I like about Ruby:
- Less punctuation than Perl and hence more readable. (This applies to braces, parentheses and semicolons, and maybe also the Perl vartype-symbols $, @ and % - though I'm of two minds about those, as I also think they contribute to clarity in most cases).
- You don't have to use local or my to get local/lexical variables. Variables in Ruby are local (not lexical) by default. (When I'm writing Perl, about 95% of the variables I use are lexical. That's a lot of my's!)
- The way you can easily string methods after each other using dot notation: variable.method1.method2(/regex).method3
- The way you can easily act on a reference rather than return a value, using "!", as in str.gsub!(/\"/n, '"'). (Although this particular example would be a bit more compact in Perl: $str=~s/\"/"/g).
What I don't like about Ruby:
- The iterator syntax (array.iterate{|v|, do_something(v)}), which admittedly is quite logical but for some reason gets on my nerves.
- No use strict.
- No CPAN (though The Ruby Application Archive is a good start).
- No poetry... at least not yet.
So, on the whole I think Ruby is quite nice. I'll follow its further development with great interest. But for now, I'm too attached to Perl to make the switch.
- Less punctuation than Perl and hence more readable. (This applies to braces, parentheses and semicolons, and maybe also the Perl vartype-symbols $, @ and % - though I'm of two minds about those, as I also think they contribute to clarity in most cases).
-
Re:Perl and Python wars
Isn't that what the Ruby project was???
;-)