Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I've been talking to a lot of people about our trade, as programmers lately. Well, let me back up. Some people here arent trade-programmers, but program for fun. So maybe some of you guys haven't gotten the ruby "buzz" thats going around.

At work, we seem to have two different kinds of programmers. Programmers who do what they do because they went to school, learned it, and they make a living doing it -- and the other kind. The programmer who seems to code because he or she actually likes to do it. I'd even call these people 'code junkies' some times.

At any rate, the more chatty of the two programmer stereotypes above is the code junkie. These are the kinds of people who will code in INTERCAL for the express purpose of a challenge or having fun coding. The cool thing is most of these people are as various and diverse as, well, people in general. So while I am a professional perl programmer, I may have a closet Forth or Scheme fetish, and my co-worker may think that JavaScript is his crack of choice.

So, like memes, sometimes programming languages go around and embed themselves in new communities. I think that perl is such a language. It caught unix admins, C programmers, and shell programmers (and my apologies, but I'm going to include awk programmers in that bunch) sort of by surprise. Lo, there was a new language, and it was pretty cool. It had new syntax and new features and made the hard tasks less hard and the impossible tasks possible (Napster clients in awk, anyone?).

Lately, I've been hearing a lot about Ruby. My friend Dan referred to it as "Perl's younger, prettier sister." A prospective employer looked at a code sample of mine (perl) and asked me if I had looked at ruby; not because it was a skill for the job, but when somebody uses perl like I do, they might be interested in Ruby.

I had heard about it, but had no idea what it was about, and the very few samples I had seen reminded me of Python, which, frankly, makes me sick.

Well, after enough people had told me to check it out, I decided to buy the book. I had just finished my new Tom Robbins Book, and had some time to kill. So I picked up Programming Ruby, The Pragmatic Programmer's Guide.

After about 20-25 pages into the book, I had Ruby pretty much understood. Many of the stuff is totally intuitive for perl programmers.

My impressions of the language are pretty much as Dan expressed it to me: it's a younger, fresher, prettier language. This isnt to say that I dont still love and won't continue programming in it. I've got a lot of time and a lot of effort invested in being a good perl programmer (despite what some of our 'bretheren' may think). Furthermore, perl has a lot more functionality in terms of modules and support. From what I can tell there is no 'rubydoc', there is no 'cran', and there is precious little literature. DBI seems to be mostly ported, including DBD::Pg, without which I could not exist.

The object creation syntax of ruby is pure ecstasy when compared to perl's. I've always been turned off by the syntactic ugliness and hoops I had to jump through to make modules in perl. In Ruby, such things not only are easy and clear, but come naturally.

Where ruby is lacking, in my opinion, is flexibility. One of the things I treasure about perl is TIMTOWTDI. A friend of mine on IRC was bitching that what perl is sorely missing is an 'elsunless'. A cute joke, but indeed, perl seems to be missing very few syntactic niceties. Ruby requires you to code in a more rigid way, and be more verbose about things. However, the things you do in Ruby are more clear and easier to code. I think in many cases, Ruby excels at being all the things Perl strives to be. Perl, however, has just hyperfocused on a few of those facets. This is where Ruby's youth shows. It is a very general language and isnt really good at doing a few specific things, it seems to be pretty good at doing a lot of different things.

Its almost like you can see where Ruby is going, but it hasn't gotten there yet. I suppose that's part of the fun of using it.

I'm not going to post contrasting code samples, as that has already been done here, and it doesnt really do the language justice.

My take on the abovementioned book is it was just not written very well. The ages-old example of the "Song" class is overused and unclear in this book. The authors neglected, very early on, to explain that Object.id returns an "id" of that object. It was never mentioned, and its output was just shown as "normal" with no explanations. I understand there is an HTML version of the book online. Read the first 20-30 pages of it, and then start coding your own Ruby. It's not hard, and you'll pick up more that way since you know Perl already.

Cheers, and happy coding.
brother dep. <!- tilly need not reply. :p ->

--
Laziness, Impatience, Hubris, and Generosity.


In reply to One more perl programmer's take on Ruby (discussion) by deprecated

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-16 07:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found