ShoeHorn writes: "Here is a good article (1st of a 4 part series), that introduces you to the Ruby language. If you are currently a programmer coming from the likes of C++, Perl, or Python, you will see some strong similarities (especially to Python)."
Let's pretend you were writing an "rcurses" library.
Need a line of 20 "-". No problem.
Anyway, from now on we'll all contact you before adding a feature to a language.
--
-... ---.-. . -....--..
Re:I think this said it all...
by
RevAaron
·
· Score: 3, Insightful
Speeds up development my arse.
Heh. Does perl speed up development? Everytime I've tried to use it, I had to have multiple browser windows open for docs and other people's code, in an attempt to figure out what the hell it's goofy syntax stood for. The small script I ended up making kind-of worked- doing the same read, search-and-replace, and write back to file only works some of the time on some of the files- I try it on a different and directory and BAM it doesn't work!
I'm not saying perl is completely flaky and useless- but contrary to Wall's silly assertions, perl isn't a language you can pickup gradually, there are simply too many rules and funny symbols ($/, @_, $_ anyone?) to learn just to do simple things.
And why the hell can you only store scalars into hashes? Pffft! And don't tell me I can just use references to non-scalar data, as refs are scalar- if I wanted to deal with C's bullshit, I would.
--
Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
Re:Why learn another language?
by
StrawberryFrog
·
· Score: 4, Insightful
Great post, but IMHO any 3-year CS course that aims to teach only one language is going about things completely the wrong way.
You should spend time in (for e.g.) a simple teaching language to start off, 1 mainstream procedural/OO language, one functional language, one scripting language and study briefly a sampling of languages of comercial or academic interest, and what makes them interesting or sucessfull.
IMHO when you learn your second language is when you start to 'get it' about what is an essential feature, and what is an accident of syntax or history in programming.
I wouldn't call knowing only 1 language a "the Computer Science Student mentality" because a CS graduate should definitely not know just one language - they should know how to pick up any language quickly, having had practice at it.
--
My Karma: ran over your Dogma
StrawberryFrog
Other languages teach other ways of thinking.
by
Futurepower(tm)
·
· Score: 3, Insightful
In the second half of his post above, Dalroth has made a very sensible case in my opinion, for learning other languages.
(Dalroth seems like the kind of programmer employers want to hire. But he has provided no way to contact him. In fact, he is very negative about being contacted in his bio.)
I'm tired of new languages (read my post #128), but Dalroth has a point that other languages sometimes teach other ways of thinking.
The answer seems to be to put all the knowledge in one place, or as few places as possible. At some point even Dalroth will decide that one more language is too many.
-- Bush's education improvements were
Re:Lots o' languages
by
ChadN
·
· Score: 4, Interesting
Actually, there is a lot of talk going on between L Wall and GvR to try to unify their bytecode interpreters (and maybe object models, etc.) for just this reason. I'm not awareof the details, but perhaps in some distant future, Python, PERL, and maybe even Ruby will all converge on a common backend (forget about TCL, though. It ain't never gonna happen)
--
"It's overkill, of course. But you can never have too much overkill." - Anonymous Slashdot Coward
Re:Strict languages vs. hacked languages
by
Hrunting
·
· Score: 3, Insightful
Usually the latter turns out to be some baroque conglomeration of features piled on features, creating a very top heavy feeling to the language, while the former classification languages all have a purity to them, e.g. smalltalk, lisp, and c.
Well, I mean, as long as we're talking in generalities here, the latter also seem to be geared towards getting jobs done where the former are geared towards elegant problem-solving. Purity is great when you're admiring something, but no one wants to hang out with the righteous virgin when they feel like getting laid. Personally, when I program, I'm not looking for my code to fit some elegant theory. I'm looking for the job to get done as succinctly as possible.
Some would defend the "hack languages" as a means to Rapid Application Development, but Smalltalk has been shown to be the most productive language, and Ruby/Python/Perl all seem to me to have a BASIC odor to them; I'm wondering if people are afraid to learn a new way of speaking?
I would say that Perl stinks more of shell and C than it does BASIC. If you're talking because it has a lot of built-in features, there are plenty of languages that have it. But out of all the languages you've mentioned, I found it ironic you say that because Perl has problem undergone the most intensive language development of any (and the new process probably blows efforts for other languages out of the water). Larry Wall has a great affinity for languages (both spoken and programming), and it shows, because, for English speakers, Perl is designed so that you can write it like you almost would speak it. Now, you might say that that is "hack"-ish, but that shows a lot more care for the process of programming than a language that idealistically sticks to a theoretical truth in favor of making the language easier to use.
And provide a link to a study that shows Smalltalk is the most productive language. I'm not saying I don't believe you, but I personally find the "hack languages" to allow a much more natural flow between my brain and the screen, so I'd be interested in seeing how that conclusion was reached.
Re:Strict languages vs. hacked languages
by
smallpaul
·
· Score: 3, Insightful
I get the stronger sense that you don't know Ruby -- most Rubyists tend to be ex-Pythoners and not the other way around, but nevermind.
People do tend to progress from more well-known languages to less well-known ones. They don't go to a bookstore and pick up a K book and think: "this would be a good first language." I've played with Ruby enough to decide that it is neat but not appropriate for many of my projects and not a sufficient improvement over Python for the rest.
Python lacks metaclasses, lacks a true unified object hierarchy, and supports multiple inheritance (considered a very bad idea by most experts in OO. Like the "goto" statement, multiple inheritance may seem useful at times but it leads to unmaintainable code). All these are simple repeats of the mistakes of C++.
Python 2.2 has metaclasses, a unified object hierarchy and supports multiple inheritance which is quite useful and safe when used thoughtfully.
It is simply a matter of historical fact that Python was not based upon C++. If it shares features with C++, those would probably be traced back to Simula through Modula-3. Smalltalk is also based upon Simula.
Yes, Python is improving, but all these improvements (like allowing the subclassing of primitives) only serve to point out flaws in the design (why aren't primitives normal objects in the first place?)
Nobody would claim that Python 1.0 was perfect, nor that Python 2.2 is perfect. Nevertheless, you haven't yet mentioned a feature of Ruby that isn't in Python 2.2. There certainly are such features -- but they get increasingly esoteric as Python improves. If I have to choose between Bertrand Meyer-approved-OO-cleanliness and native threads that don't block when you do I/O, I would choose the solid threads. OO-cleanliness is about conceptual elegance and native threads are about getting the job done.
And how deep is Ruby's Unicode support? If you can please point me to documentation on using Ruby's regexp engine to match Unicode characters, I would appreciate it.
My current Python projects depend heavily on both threads and Unicode. Mixins, multiple inheritance and the ability subclass "integer" really don't matter one whit! I am mostly happy that Python is unifying its type system for rhetorical reasons. Practically it hardly matters at all!
If you want to impress the vast majority of programmers who are not language collectors, you'll have to show us some program that are hard to solve in (e.g.) Python and easy to solve in Ruby.
For this and other reasons, it is not accurate to paint Ruby as the next step after Python. It is another good language with strengths and weaknesses. One day it will have a superset of features that Python currently has...but Python will itself have evolved by then.
As the guy who wrote the article.
by
poet
·
· Score: 5, Informative
It is important not to judge Ruby on this article.
The content in the article is specifically designed to look like either Perl or Python. This was to generate a similarity that programmers from other languages can understand.
The second one, article in the series looks a lot less like Perl and more like Python. This is due to Ruby being a true OO, very similar to Python.
The third article will (if they let me write it) cover advanced Ruby structures and illustrate them by interfacing with the PostgreSQL database.
The fourth article will cover Ruby/Qt.
If you guys want to see these articles you may want to give some decent feedback on the Developer Works site.
-- Get your PostgreSQL here: http://www.commandprompt.com/
Re:Java has won *nothing*
by
auntfloyd
·
· Score: 3, Informative
Because it is not Open Source, it is highly unportable (just try running Java on OpenBSD sometime!)
Ok. On a just-installed machine (complete with generic kernel, yes I know):
(rob@denali:~)$ uname -a
OpenBSD denali.CENSORED.com 2.9 GENERIC#653 i386
(rob@denali:~)$ java -version
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)
That's OpenBSD 2.9 running the latest JDK 1.4 beta. What were you saying again?
You also seem to be confusing Java (the platform) with Sun's version of Java. Open Source editions (eg Kaffe can run on just about anything. Not to mention that you can get the sources to Sun's JDK.
Re:Why learn another language?
by
RevAaron
·
· Score: 3, Insightful
That is, for the most part true, but there are languages that make it difficult and some that make it easy. For me, no matter how much I am forced to use it in school, C++ is still a lot harder to express ideas (especially well-designed OO ones) than some of the other languages I know. This is for a lot of reasons, from syntax to manual memory management. Now, it's not that what I want to do is impossible in C++, but there's a lot more crap I have to think about and deal with to get the same basic stuff done.
--
Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
The Pragmatic Programmers Ruby Book is Online
by
swagr
·
· Score: 4, Informative
Re:Java has won *nothing*
by
RevAaron
·
· Score: 3, Informative
Some stupidities though -- the whole notion of making variable types case-sensitive reeks of Fortran.
That's because they're not types, they're classes. And why does that matter? Because all you reference a class by it's name- as a VARIABLE. If all Ruby variables were case-insensitive, then classes, or types as you refer to them, would also be case-insensitive.
It's simple, beautifful elegance. This is unlike other languages, where types and/or classes are an exception, aren't normal variables. There lie's power in Ruby's approach.
--
Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
Re:Strict languages vs. hacked languages
by
Jonathan
·
· Score: 3, Insightful
And how deep is Ruby's Unicode support? If you can please point me to documentation on using Ruby's regexp engine to match Unicode characters, I would appreciate it.
Here you have an issue of implementation, not design, but at present a legitimate issue. Ruby is a product of Japan, and ironically, from the perspective of Westerners, who generally see Unicode as a sort of peace offering to Asians to make up for the dark ages of ASCII, the Japanese hate Unicode and prefer their own multibyte solution. So, the status of Unicode in Ruby is somewhat primitive at present. However, as Ruby was designed with multibyte characters in mind, it should be much easier to improve the Unicode support than in other languages.
Time for an icon....
by
jeffy124
·
· Score: 3, Insightful
I think it's time for Slashdot to draw up an icon for Ruby topics. This story is about the 5th maybe 6th Ruby related item to appear on/. in the past few months. A simple picture of a good red-ruby you would find in a jewelery store would do fine, such as one of these. Anyone for it? Against it? Got a better pic to use?
-- The One Rule Of Chess You'll Ever Need: Don't play someone who carries a kit in their bookbag.
missing the point
by
mj6798
·
· Score: 3, Insightful
If Python was the result of Lisp and C++ having a baby, Ruby is the result of Perl and Smalltalk having a baby.
The key features of Lisp are the use of a uniform notation for programs and data, a notation that makes it very easy to write syntactic extensions, and full support for functional programming. Python 2.1 now has some limited support for lexical closures, but users almost never extend its syntax. The key feature of Smalltalk is its programming environment. As a language, Smalltalk's main feature is the use of very descriptive method and argument names. Neither of those is shared by Ruby.
Python, Perl, and Ruby are nifty little scripting languages, but don't think for a moment that if you are using them you are using the next generation of Lisp or Smalltalk. The object models of Python, Perl, and Ruby are general but slow and memory intensive, their programming environments are oriented towards scripting, not large system development, and compilation to native code, when it exists at all, is of limited benefit. If the scripting languages ever evolve into something like Lisp or Smalltalk, their object models, syntax, and semantics will have to change dramatically and incompatibly.
Re:Strict languages vs. hacked languages
by
Peaker
·
· Score: 3, Insightful
I agree Ruby and Perl seem to be like the latter type.
Python, however, is a truly clean, well-designed, quite-pure, strong-typed language.
I wouldn't say it has a Basic odor at all, besides for a built-in 'print', perhaps:)
Basic is braindead and has no library - instead, it has its entire library built into its syntax in a horrid way.
Python is the exact opposite - many many libraries separated into modular modules, with only flow constructs, OO organization, functions and exception handling built in.
when you end up in Mexico with an English-to-Mexican and vice-a-versa dictionary.
Mexican? Everyone knows they speak Latin in Latin America.
Re:Why worry about importing IT workers,
by
jeffy124
·
· Score: 3, Informative
and for the MS route
[...]
(Java/no other language is as useless to compete with Java)
I think you're under the false impression that Java was written by Microsoft. You also probably don't use java for anything hence feel it's unnecessary. If you want a good, easy to maintain and robust app on multiple platforms then use java, but if you need that app ready to go into production quickly, then java is not your best choice, scripting languages like Perl are. I havent learned Python as of yet, but based on what I'm told, it's good for getting an app done quickly.
-- The One Rule Of Chess You'll Ever Need: Don't play someone who carries a kit in their bookbag.
Re:Strict languages vs. hacked languages
by
FFFish
·
· Score: 3, Insightful
FWIW, within a week you'll learn to love whitespace. Yes, it imposes a visual "order" to your code. You'll soon appreciate the consistency: you can look at other code and immediately make sense of it, without having to mentally adjust for the other programmer's weird habits.
--
--
Don't like it? Respond with words, not karma.
Re:word math
by
ConsumedByTV
·
· Score: 3, Insightful
but is there anything wrong with making it a simpler operation?
--
"Not my manner of thinking but the manner of thinking of others has been the source of my unhappiness." - M
Re:Strict languages vs. hacked languages
by
smallpaul
·
· Score: 5, Interesting
I notice strong distinctions between those languages that have been developed by actual programming language researchers and those who hack together a language to scratch an itch.
"Actual programming language researchers" are typically not even interested in designing languages for general purpose use. Often they are just trying to explore a particular idea of aspect of programming.
Usually the latter turns out to be some baroque conglomeration of features piled on features, creating a very top heavy feeling to the language, while the former classification languages all have a purity to them, e.g. smalltalk, lisp, and c.
I think you're going to have to define your terms if you want to make this point. How were Kernighan and Richie programming language researchers but not Van Rossum and Wall? By now, the latter two have spent about ten years of their lives thinking about almost nothing other than programming languages.
Some would defend the "hack languages" as a means to Rapid Application Development, but Smalltalk has been shown to be the most productive language,
Could you provide a reference to back up that claim? I'd like to see evidence that Smalltalk fares well at system administration or text processing.
and Ruby/Python/Perl all seem to me to have a BASIC odor to them;
Now you are really grasping. That claim isn't even solid enough to refute.
...I'm wondering if people are afraid to learn a new way of speaking?
I don't know...are you? If you are into purity and elegance, I would suggest you give either Python or Ruby a real try. There are many Lisp fans that like both and Ruby is especially popular amoung Smalltalk users.
Don't judge ruby based on the article
by
MeowMeow+Jones
·
· Score: 5, Interesting
There's nothing wrong with it, it just doesn't get into any of the crazy stuff that makes ruby ruby. So wait until the other parts come out or check out the Pragmatic Programmers Guide.
If Python was the result of Lisp and C++ having a baby, Ruby is the result of Perl and Smalltalk having a baby.
Strict languages vs. hacked languages
by
Anonymous Coward
·
· Score: 4, Interesting
I notice strong distinctions between those languages that have been developed by actual programming language researchers and those who hack together a language to scratch an itch.
Usually the latter turns out to be some baroque conglomeration of features piled on features, creating a very top heavy feeling to the language, while the former classification languages all have a purity to them, e.g. smalltalk, lisp, and c.
Some would defend the "hack languages" as a means to Rapid Application Development, but Smalltalk has been shown to be the most productive language, and Ruby/Python/Perl all seem to me to have a BASIC odor to them; I'm wondering if people are afraid to learn a new way of speaking?
Yes, there is DB access
by
JimWeirich
·
· Score: 4, Informative
There is a DBI module at http://www.ruby-projects.org/dbi/ . There are also a number of DB specific modules. See the Ruby Application Archive ( http://www.ruby-lang.org/en/raa.html ) for a list of other software modules that are available for Ruby.
-- -- Jim Weirich
Why learn another language?
by
Dalroth
·
· Score: 5, Informative
Well, I see a lot of people complaining as usual... Why should they learn another language? So I thought I would throw in my $0.02 for all a languages (not just Ruby, which I am particularly fond of).
A lot of you people come from what I call the Computer Science Student mentality. This unfortunately something I've noticed as a side effect of the way computer science is taught in most schools. It's quite unfortunate, because that clearly isn't the aim of the Professor's when they are teaching classes this way.
I'll use my school as an example. When I started at the University of Dayton, about 7 years ago, every class was taught in ADA. It was a horrible horrible expierence. The ADA compilers were horribly lacking at the time, and anybody who has done any work in ADA will know that it is an extremely strict and picky language. That has it's good and bad sides when it comes to teaching programming, but I'll save that for a different discussion. I had no problems, since, well, I had a good solid 4 years for Pascal and C/C++ programming experience before I even started college, but this seriously affected the other students in my class.
The problem was, about two years into the program, my school decided (thank god) to switch the department over to C++. This was a great move, because now the students were being taught a language that they could actually apply in the real world (beyond the confines of the Wright Patterson Air Force base anyway). It worked out quite well for the newer students, but my classmates were blindsided. Most of them suffered through half a semester of C (the other half of the semester was 360 assembler) and never even touched upon C++. They should have just been able to pick up a C++ book, apply the concepts they learned from their ADA classes and the syntax from the C++ book and their C course and move on, but most of them had a hard time doing it.
Why was that? They all knew the concepts. They all knew how to write their algorithms, and their trees, and their stacks and queues. Yeah, they weren't taught how to write real software, but they clearly knew the basics. I spent more time helping others learn these concepts than I did doing my own homework the first two years, so I know what they were capable of from first hand experience.
The problem was entirely in their minds. C++ is a huge ugly beast, and it is a bit imposing when you first start. But if you've got two solid years of programming behind you, it should be a relatively smooth and easy transition. Most of them didn't realize this though. They were scared of C++, they were scared of new languages, and they suffered as a result.
The simple fact of the matter is, if you know one language, you know them all. It's not the syntax that makes the difference, it's the concepts that you express within the framework of the language's syntax that are the real guts of programming. My classmates took awhile to realize this (and I'm sure many of them still don't). That's the same thing with Ruby, or Python, or Perl, or just about any language. Unless you are making the jump from procedural to OOP, or OOP to Functional for the first time, you *CAN* pick up a book and learn a new language in a days time. The only thing stopping you is yourself.
Now, the other part of this is, why would you do that? I love learning new languages, and I love learning new languages for a few reasons. These reasons apply to every programmer, and I honestly don't understand why some people are so opposed to learning something new. I guess that's what seperates a good programmer from a bad programmer. So if you want to know why you should learn Ruby, or LISP, or Haskell, or even Visual Basic, I'll tell you why.
1. It helps keep your skills in tip top shape. Perusing a computer manual may remind you of algorithms or techniques you haven't used in a long time and forgotten.
2. You always seem to learn something new. Not some new technical trick that only works in one lanuage (although that definitely happens), but just a different way of approaching problems that sometimes can transcend language boundaries.
3. You may find a new language that allows you to get the job done faster!
4. You're enhanced knowlege of languages looks great on your resume no matter what you use as your primary language.
5. You learn the way other people think. And I don't want to gloss over this one. As a programmer, you frequently have to work with other programmers. Learning new languages is a *GREAT* way to see how other people do things. To learn the way other people think, so to speak. By learning Ruby and Smalltalk, you start to learn why people in those communities are so die hard about OOP programming styles. By learning LISP or Haskell you start to learn why Functional styles even exist! And it all comes back full circle. Techniques I learned from Haskell I now use when writing C++ programs and vice versa. It only made my C++ code better.
Knowlege is power, and learning new languages is one (of many) ways of increasing your knowlege. Go ahead and try it, even if you think you won't use the language, and even if you're just starting out and don't think the transition from your learning language to a new one will be easy. You just might be surprised by how much you already know, and how much you have yet to learn. That's the real benefit of it.
Okay, it looks simple enough..
by
jcr
·
· Score: 3, Insightful
..so, what does it offer over Python once you get past "Hello World" * 3?
Is there anyone who can fill us in on why this language is worth using?
-jcr
-- The only title of honor that a tyrant can grant is "Enemy of the State."
Let's pretend you were writing an "rcurses" library. Need a line of 20 "-". No problem. Anyway, from now on we'll all contact you before adding a feature to a language.
-... ---
Heh. Does perl speed up development? Everytime I've tried to use it, I had to have multiple browser windows open for docs and other people's code, in an attempt to figure out what the hell it's goofy syntax stood for. The small script I ended up making kind-of worked- doing the same read, search-and-replace, and write back to file only works some of the time on some of the files- I try it on a different and directory and BAM it doesn't work!
I'm not saying perl is completely flaky and useless- but contrary to Wall's silly assertions, perl isn't a language you can pickup gradually, there are simply too many rules and funny symbols ($/, @_, $_ anyone?) to learn just to do simple things.
And why the hell can you only store scalars into hashes? Pffft! And don't tell me I can just use references to non-scalar data, as refs are scalar- if I wanted to deal with C's bullshit, I would.
Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
Great post, but IMHO any 3-year CS course that aims to teach only one language is going about things completely the wrong way.
You should spend time in (for e.g.) a simple teaching language to start off, 1 mainstream procedural/OO language, one functional language, one scripting language and study briefly a sampling of languages of comercial or academic interest, and what makes them interesting or sucessfull.
IMHO when you learn your second language is when you start to 'get it' about what is an essential feature, and what is an accident of syntax or history in programming.
I wouldn't call knowing only 1 language a "the Computer Science Student mentality" because a CS graduate should definitely not know just one language - they should know how to pick up any language quickly, having had practice at it.
My Karma: ran over your Dogma
StrawberryFrog
In the second half of his post above, Dalroth has made a very sensible case in my opinion, for learning other languages.
(Dalroth seems like the kind of programmer employers want to hire. But he has provided no way to contact him. In fact, he is very negative about being contacted in his bio.)
I'm tired of new languages (read my post #128), but Dalroth has a point that other languages sometimes teach other ways of thinking.
The answer seems to be to put all the knowledge in one place, or as few places as possible. At some point even Dalroth will decide that one more language is too many.
Bush's education improvements were
Actually, there is a lot of talk going on between L Wall and GvR to try to unify their bytecode interpreters (and maybe object models, etc.) for just this reason. I'm not awareof the details, but perhaps in some distant future, Python, PERL, and maybe even Ruby will all converge on a common backend (forget about TCL, though. It ain't never gonna happen)
"It's overkill, of course. But you can never have too much overkill." - Anonymous Slashdot Coward
Usually the latter turns out to be some baroque conglomeration of features piled on features, creating a very top heavy feeling to the language, while the former classification languages all have a purity to them, e.g. smalltalk, lisp, and c.
Well, I mean, as long as we're talking in generalities here, the latter also seem to be geared towards getting jobs done where the former are geared towards elegant problem-solving. Purity is great when you're admiring something, but no one wants to hang out with the righteous virgin when they feel like getting laid. Personally, when I program, I'm not looking for my code to fit some elegant theory. I'm looking for the job to get done as succinctly as possible.
Some would defend the "hack languages" as a means to Rapid Application Development, but Smalltalk has been shown to be the most productive language, and Ruby/Python/Perl all seem to me to have a BASIC odor to them; I'm wondering if people are afraid to learn a new way of speaking?
I would say that Perl stinks more of shell and C than it does BASIC. If you're talking because it has a lot of built-in features, there are plenty of languages that have it. But out of all the languages you've mentioned, I found it ironic you say that because Perl has problem undergone the most intensive language development of any (and the new process probably blows efforts for other languages out of the water). Larry Wall has a great affinity for languages (both spoken and programming), and it shows, because, for English speakers, Perl is designed so that you can write it like you almost would speak it. Now, you might say that that is "hack"-ish, but that shows a lot more care for the process of programming than a language that idealistically sticks to a theoretical truth in favor of making the language easier to use.
And provide a link to a study that shows Smalltalk is the most productive language. I'm not saying I don't believe you, but I personally find the "hack languages" to allow a much more natural flow between my brain and the screen, so I'd be interested in seeing how that conclusion was reached.
People do tend to progress from more well-known languages to less well-known ones. They don't go to a bookstore and pick up a K book and think: "this would be a good first language." I've played with Ruby enough to decide that it is neat but not appropriate for many of my projects and not a sufficient improvement over Python for the rest.
Python 2.2 has metaclasses, a unified object hierarchy and supports multiple inheritance which is quite useful and safe when used thoughtfully.
It is simply a matter of historical fact that Python was not based upon C++. If it shares features with C++, those would probably be traced back to Simula through Modula-3. Smalltalk is also based upon Simula.
Nobody would claim that Python 1.0 was perfect, nor that Python 2.2 is perfect. Nevertheless, you haven't yet mentioned a feature of Ruby that isn't in Python 2.2. There certainly are such features -- but they get increasingly esoteric as Python improves. If I have to choose between Bertrand Meyer-approved-OO-cleanliness and native threads that don't block when you do I/O, I would choose the solid threads. OO-cleanliness is about conceptual elegance and native threads are about getting the job done.
And how deep is Ruby's Unicode support? If you can please point me to documentation on using Ruby's regexp engine to match Unicode characters, I would appreciate it.
My current Python projects depend heavily on both threads and Unicode. Mixins, multiple inheritance and the ability subclass "integer" really don't matter one whit! I am mostly happy that Python is unifying its type system for rhetorical reasons. Practically it hardly matters at all!
If you want to impress the vast majority of programmers who are not language collectors, you'll have to show us some program that are hard to solve in (e.g.) Python and easy to solve in Ruby.
For this and other reasons, it is not accurate to paint Ruby as the next step after Python. It is another good language with strengths and weaknesses. One day it will have a superset of features that Python currently has...but Python will itself have evolved by then.
It is important not to judge Ruby on this article.
The content in the article is specifically designed to look like either Perl or Python. This was to generate a similarity that programmers from other languages can understand.
The second one, article in the series looks a lot less like Perl and more like Python. This is due to Ruby being a true OO, very similar to Python.
The third article will (if they let me write it) cover advanced Ruby structures and illustrate them by interfacing with the PostgreSQL database.
The fourth article will cover Ruby/Qt.
If you guys want to see these articles you may want to give some decent feedback on the Developer Works site.
Get your PostgreSQL here: http://www.commandprompt.com/
Because it is not Open Source, it is highly unportable (just try running Java on OpenBSD sometime!)
Ok. On a just-installed machine (complete with generic kernel, yes I know):
(rob@denali:~)$ uname -a
OpenBSD denali.CENSORED.com 2.9 GENERIC#653 i386
(rob@denali:~)$ java -version
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)
That's OpenBSD 2.9 running the latest JDK 1.4 beta. What were you saying again?
You also seem to be confusing Java (the platform) with Sun's version of Java. Open Source editions (eg Kaffe can run on just about anything. Not to mention that you can get the sources to Sun's JDK.
That is, for the most part true, but there are languages that make it difficult and some that make it easy. For me, no matter how much I am forced to use it in school, C++ is still a lot harder to express ideas (especially well-designed OO ones) than some of the other languages I know. This is for a lot of reasons, from syntax to manual memory management. Now, it's not that what I want to do is impossible in C++, but there's a lot more crap I have to think about and deal with to get the same basic stuff done.
Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
here.
-... ---
That's because they're not types, they're classes. And why does that matter? Because all you reference a class by it's name- as a VARIABLE. If all Ruby variables were case-insensitive, then classes, or types as you refer to them, would also be case-insensitive.
It's simple, beautifful elegance. This is unlike other languages, where types and/or classes are an exception, aren't normal variables. There lie's power in Ruby's approach.
Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
And how deep is Ruby's Unicode support? If you can please point me to documentation on using Ruby's regexp engine to match Unicode characters, I would appreciate it.
Here you have an issue of implementation, not design, but at present a legitimate issue. Ruby is a product of Japan, and ironically, from the perspective of Westerners, who generally see Unicode as a sort of peace offering to Asians to make up for the dark ages of ASCII, the Japanese hate Unicode and prefer their own multibyte solution. So, the status of Unicode in Ruby is somewhat primitive at present. However, as Ruby was designed with multibyte characters in mind, it should be much easier to improve the Unicode support than in other languages.
I think it's time for Slashdot to draw up an icon for Ruby topics. This story is about the 5th maybe 6th Ruby related item to appear on /. in the past few months. A simple picture of a good red-ruby you would find in a jewelery store would do fine, such as one of these. Anyone for it? Against it? Got a better pic to use?
The One Rule Of Chess You'll Ever Need: Don't play someone who carries a kit in their bookbag.
The key features of Lisp are the use of a uniform notation for programs and data, a notation that makes it very easy to write syntactic extensions, and full support for functional programming. Python 2.1 now has some limited support for lexical closures, but users almost never extend its syntax. The key feature of Smalltalk is its programming environment. As a language, Smalltalk's main feature is the use of very descriptive method and argument names. Neither of those is shared by Ruby.
Python, Perl, and Ruby are nifty little scripting languages, but don't think for a moment that if you are using them you are using the next generation of Lisp or Smalltalk. The object models of Python, Perl, and Ruby are general but slow and memory intensive, their programming environments are oriented towards scripting, not large system development, and compilation to native code, when it exists at all, is of limited benefit. If the scripting languages ever evolve into something like Lisp or Smalltalk, their object models, syntax, and semantics will have to change dramatically and incompatibly.
I agree Ruby and Perl seem to be like the latter type. :)
Python, however, is a truly clean, well-designed, quite-pure, strong-typed language.
I wouldn't say it has a Basic odor at all, besides for a built-in 'print', perhaps
Basic is braindead and has no library - instead, it has its entire library built into its syntax in a horrid way.
Python is the exact opposite - many many libraries separated into modular modules, with only flow constructs, OO organization, functions and exception handling built in.
when you end up in Mexico with an English-to-Mexican and vice-a-versa dictionary.
Mexican? Everyone knows they speak Latin in Latin America.
[...]
(Java/no other language is as useless to compete with Java)
I think you're under the false impression that Java was written by Microsoft. You also probably don't use java for anything hence feel it's unnecessary. If you want a good, easy to maintain and robust app on multiple platforms then use java, but if you need that app ready to go into production quickly, then java is not your best choice, scripting languages like Perl are. I havent learned Python as of yet, but based on what I'm told, it's good for getting an app done quickly.
The One Rule Of Chess You'll Ever Need: Don't play someone who carries a kit in their bookbag.
FWIW, within a week you'll learn to love whitespace. Yes, it imposes a visual "order" to your code. You'll soon appreciate the consistency: you can look at other code and immediately make sense of it, without having to mentally adjust for the other programmer's weird habits.
--
Don't like it? Respond with words, not karma.
but is there anything wrong with making it a simpler operation?
"Not my manner of thinking but the manner of thinking of others has been the source of my unhappiness." - M
If Python was the result of Lisp and C++ having a baby, Ruby is the result of Perl and Smalltalk having a baby.
Trolls throughout history:
Jonathan Swift
I notice strong distinctions between those languages that have been developed by actual programming language researchers and those who hack together a language to scratch an itch.
Usually the latter turns out to be some baroque conglomeration of features piled on features, creating a very top heavy feeling to the language, while the former classification languages all have a purity to them, e.g. smalltalk, lisp, and c.
Some would defend the "hack languages" as a means to Rapid Application Development, but Smalltalk has been shown to be the most productive language, and Ruby/Python/Perl all seem to me to have a BASIC odor to them; I'm wondering if people are afraid to learn a new way of speaking?
There is a DBI module at http://www.ruby-projects.org/dbi/ . There are also a number of DB specific modules. See the Ruby Application Archive ( http://www.ruby-lang.org/en/raa.html ) for a list of other software modules that are available for Ruby.
-- Jim Weirich
Well, I see a lot of people complaining as usual... Why should they learn another language? So I thought I would throw in my $0.02 for all a languages (not just Ruby, which I am particularly fond of).
A lot of you people come from what I call the Computer Science Student mentality. This unfortunately something I've noticed as a side effect of the way computer science is taught in most schools. It's quite unfortunate, because that clearly isn't the aim of the Professor's when they are teaching classes this way.
I'll use my school as an example. When I started at the University of Dayton, about 7 years ago, every class was taught in ADA. It was a horrible horrible expierence. The ADA compilers were horribly lacking at the time, and anybody who has done any work in ADA will know that it is an extremely strict and picky language. That has it's good and bad sides when it comes to teaching programming, but I'll save that for a different discussion. I had no problems, since, well, I had a good solid 4 years for Pascal and C/C++ programming experience before I even started college, but this seriously affected the other students in my class.
The problem was, about two years into the program, my school decided (thank god) to switch the department over to C++. This was a great move, because now the students were being taught a language that they could actually apply in the real world (beyond the confines of the Wright Patterson Air Force base anyway). It worked out quite well for the newer students, but my classmates were blindsided. Most of them suffered through half a semester of C (the other half of the semester was 360 assembler) and never even touched upon C++. They should have just been able to pick up a C++ book, apply the concepts they learned from their ADA classes and the syntax from the C++ book and their C course and move on, but most of them had a hard time doing it.
Why was that? They all knew the concepts. They all knew how to write their algorithms, and their trees, and their stacks and queues. Yeah, they weren't taught how to write real software, but they clearly knew the basics. I spent more time helping others learn these concepts than I did doing my own homework the first two years, so I know what they were capable of from first hand experience.
The problem was entirely in their minds. C++ is a huge ugly beast, and it is a bit imposing when you first start. But if you've got two solid years of programming behind you, it should be a relatively smooth and easy transition. Most of them didn't realize this though. They were scared of C++, they were scared of new languages, and they suffered as a result.
The simple fact of the matter is, if you know one language, you know them all. It's not the syntax that makes the difference, it's the concepts that you express within the framework of the language's syntax that are the real guts of programming. My classmates took awhile to realize this (and I'm sure many of them still don't). That's the same thing with Ruby, or Python, or Perl, or just about any language. Unless you are making the jump from procedural to OOP, or OOP to Functional for the first time, you *CAN* pick up a book and learn a new language in a days time. The only thing stopping you is yourself.
Now, the other part of this is, why would you do that? I love learning new languages, and I love learning new languages for a few reasons. These reasons apply to every programmer, and I honestly don't understand why some people are so opposed to learning something new. I guess that's what seperates a good programmer from a bad programmer. So if you want to know why you should learn Ruby, or LISP, or Haskell, or even Visual Basic, I'll tell you why.
1. It helps keep your skills in tip top shape. Perusing a computer manual may remind you of algorithms or techniques you haven't used in a long time and forgotten.
2. You always seem to learn something new. Not some new technical trick that only works in one lanuage (although that definitely happens), but just a different way of approaching problems that sometimes can transcend language boundaries.
3. You may find a new language that allows you to get the job done faster!
4. You're enhanced knowlege of languages looks great on your resume no matter what you use as your primary language.
5. You learn the way other people think. And I don't want to gloss over this one. As a programmer, you frequently have to work with other programmers. Learning new languages is a *GREAT* way to see how other people do things. To learn the way other people think, so to speak. By learning Ruby and Smalltalk, you start to learn why people in those communities are so die hard about OOP programming styles. By learning LISP or Haskell you start to learn why Functional styles even exist! And it all comes back full circle. Techniques I learned from Haskell I now use when writing C++ programs and vice versa. It only made my C++ code better.
Knowlege is power, and learning new languages is one (of many) ways of increasing your knowlege. Go ahead and try it, even if you think you won't use the language, and even if you're just starting out and don't think the transition from your learning language to a new one will be easy. You just might be surprised by how much you already know, and how much you have yet to learn. That's the real benefit of it.
..so, what does it offer over Python once you get past "Hello World" * 3?
Is there anyone who can fill us in on why this language is worth using?
-jcr
The only title of honor that a tyrant can grant is "Enemy of the State."