Slashdot Log In
Programming in the Ruby Language
Posted by
michael
on Sat Aug 11, 2001 05:11 PM
from the no-semicolons dept.
from the no-semicolons dept.
This discussion has been archived.
No new comments can be posted.
Programming in the Ruby Language
|
Log In/Create an Account
| Top
| 345 comments
| Search Discussion
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Why worry about importing IT workers, (Score:1, Insightful)
Pick one from each of the following:
(C/C++)
(Perl/Tcl)
(sh,ksh)
Now for the 'bonus' round. [pass go and collect $200 more a month]
(php,python)
and for the MS route, you only get 3:
(C++/C#)
(Visual Basic/there is no other option)
(Java/no other language is as useless to compete with Java)
Now...how far off am I?
15 languages is enough. (Score:2, Insightful)
I'm just guessing, but I think I have learned at least 15 programming languages. Maybe it is 30, if you count assembly languages. At some point, learning languages must come to an end. At some point, I would like to see all the good features put into one or two languages. I have no intention of using my life learning languages that then die very quickly, like Pascal.
It seems that, at some point, every skilled programmer becomes interested in writing either an editor or a computer language. I wrote one myself, for use with some H-P data acquisition equipment. Now both the equipment and language are obsolete.
With every new language, there are years of extending the language, finding and curing the bugs, and wrestling with incompatibility problems. At some point, this must stop.
Language writers should put their creativity into extending C++ rather than abandoning it.
Consider Java, for example. There have been literally years of hassle and discussion about Java, when it could have been implemented merely as a compiler switch to a C++ compiler. The compiler switch could have provided automatic garbage collection, given error messages for use of pointers, and provided the other features of Java.
Microsoft, following its usual abusive practices, put many ease-of-use features into Visual Basic, while keeping them out of Visual C++. The result was that there are maybe 1,500,000 programmers who know Visual Basic, but don't know a real language. And what language is Visual Basic itself programmed in? C++, of course.
When you write in Visual Basic, you are just a dog on a leash. Anytime Microsoft wants to yank your chain, it can. If Bill Gates happens to lose interest, Microsoft can kill this one-OS language, the way it killed xBase (dBase, FoxPro), for example, by making quirky additions that no other vendor could/would follow, and then abandoning development.
It is a shortcoming of the U.S. culture that so many men feel that they must play King on the Mountain, and try to knock everyone else down, rather than cooperate.
Like everyone, Bill Gates has inner conflict. But don't let his anger and obsessive desire to make money reduce the quality of your life!
So now it is Ruby, supposedly the next big thing. How long will it be until the books are all written? How long until we discover the shortcomings? Is there some feature in Ruby that can't possibly be added to another language?
I reviewed Ruby a little about a year ago, but came to the conclusion that the documentation was extremely poor. The overall value of a language is the value of the language itself, plus the quality of documentation of the language.
At some point, I want the merry-go-round to stop, so that I can get off.
Is there something in C# that simply could not be made a compiler switch to C++? Do we really need more syntax? I'm not saying I know all the answers to some of these issues. But I sense that something bad is happening.
For a few years, languages were interesting to me. But now, I just want to do the job, not discover other ways to do the job. Let's move on, rather than repeating what we have done before. Let's improve what we have, rather than starting again.
Is there a tutorial for perl that is simalar ? (Score:2)
Please clarify (Score:1)
Yes that I can see, but what about the favorable differences.
I hope this is implemented in PERL (Score:1)
otherwise someone worked too hard.
Performance, gentlmen (and ladies)? (Score:2, Interesting)
Lots like PHP (Score:1)
This looks really cool. Sure beats the hell out of learning Perl for system administration scripts, since I already know PHP and have a basic understanding of OOP...
what type of shot is Ruby ? (Score:2)
We've all seen the usenet post in the coffee room or on various websites. Usually under some title like:
- Shooting Yourself in the Foot [netzmafia.de]
- How to Shoot Yourself in the Foot using: [yucom.be]
- TASK
:- To Shoot Yourself In The Foot [m5p.com]
So how does one go about shooting themselves in the foot with Ruby ?Horses for Courses (Score:2, Interesting)
A associate once said about programming its "Horses for courses". What he meant was that we should use the best tool for the job at hand. When he said it he was talking about using Clipper (an dBase clone) over Quick Basic in 1990.
Today I know two languages to what I consider 'professional level'. On Windows I develop stand alone applications with Delphi. Its easy to develop quality code - I define quality in this case by not crashing due to obscure memory errors. Its very hard to write code in Delphi which causes memory handling issues. Writing Delphi feels like the IDE wants to help you, but if you want to get your hands dirty you still can (unlike VB).
For Web Development I now use Java. I wouldn't use Java for stand alone GUI apps because its still too slow compared to Delphi, but for server side web development it has the features I want - portability, easy to develop in, connects with SQL etc.
Learning a new syntax takes time. You need to be sure that a new language is going to have a payoff in terms of being able to achieve something you can't in others. For years I wrote Delphi, as it was the best horse for the course. Now with Web Develoipment the course has changed, and Java is best (for me).
That said, a programmer should be able to learn any language. But just because you can doesn't mean you should...
As the guy who wrote the article. (Score:5, Informative)
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.
word math (Score:1, Interesting)
so many choices (Score:2, Insightful)
Glad I changed from a CS major (Score:1)
Check out this translated Japanese Ruby guide (Score:1)
RUBY just.. smells.. (Score:1)
The Pragmatic Programmers Ruby Book is Online (Score:4, Informative)
I think this said it all... (Score:1)
Time for an icon.... (Score:3, Insightful)
Lots o' languages (Score:2)
Re:Lots o' languages (Score:4, Interesting)
DB access? (Score:1)
Yes, there is DB access (Score:4, Informative)
Don't judge ruby based on the article (Score:5, Interesting)
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 (Score:4, Interesting)
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?
Re:Strict languages vs. hacked languages (Score:5, Interesting)
ICFP (Score:1, Troll)
Why learn another language? (Score:5, Informative)
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.
Re:Why learn another language? (Score:4, Insightful)
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.
Okay, it looks simple enough.. (Score:3, Insightful)
Is there anyone who can fill us in on why this language is worth using?
-jcr
Mod Parent UP Funny, not DOWN Troll (Score:2, Interesting)
For embedded systems: C# has a defined bytecode that can be JIT compiled onto a variety of special purpose chips without rewriting anything.
Web Programming: C# has built in XML and network support, and don't forget that because everything tunnels over port 80, no firewall will prevent your code from executing!
Instead, all of the statements are absolutely absurd. Maybe you don't think it is funny, but it is absolutely NOT a troll. Trolls try to say things that have a basis in reality but are completely non-constructive for the purposes of discussion to have people respond (I'm not sure where the line to Flamebait is, but...). This is just a joke.
Re:RUBY=SUCKS (Score:1)
Name a single feature in C# that hasn't appeared in at least 3 languages prior to it.
Anyhow, I'd take Python, C++ or LISP before I'd take C#, for any task. (The first for elegance and ease, the second for performance, and the third for its power).
Re:productive? (Score:2)
If that were true, you could just as easily write a text processing system in raw assembly or in a scripting language. I don't believe that. Languages are tools. Different tools effect your productivity in different ways. A farmer's productivity does depend on his tools and so does a programmer's.
Re:So (Score:1)
Yeah collecting languages is like collecting rocks (Score:1)
I moved to Asia from California in my early twenties looking for fame and fotrune and sleazy discos. In the latter, I met all these cute asian babes who could speak three or four languages on average. As an American I was so impressed by this. I assumed these lurid disco dollies were really on the ball. Over time, I realized how far from the mark I was and how totally disconnected language skills and intelligence were.
I knew girls who were raped and beaten repeatedly and I made the mistake of trying to step in and act all righteous like an American boy thinks he oughtta, but boy did I find out the hard way that my assistance was not welcomed and even led to hostility from the victims themselves even when they had come to me crying and asking for help.
Fair enough, I learned a bit about the real world and how to detatch myself from other people's affairs --even the cute ones asking for help. I also learned that the ability to memorize languages is not an indicator of intelligence as I understand the term.
Having said this, I'm very proud of my own Chinese and English literary skills and I consider myself a sophisticated programmer although I wouldn't know C code from a chemistry formula.
It goes back to the phrase "to be well read." You know the deal, you can read three books and be well read; wheras you can read variations on the same trash all your life and never make the grade.
Re:productive? (Score:2)
The best tool for the job isn't always the one the developer is most familiar with. There are many things I would rather develop with Perl over C, even though I've only been using it heavily for two years. I've been a C programmer of the almost-every-day sort for two years short of a decade now.
Us younger programmers who are blessed with languages that are more articulate allow us to see the big picture sooner, and more clearly.