Slashdot Mirror


Beginning Ruby

TimHunter writes "Peter Cooper's Beginning Ruby: From Novice to Professional has two audiences, novices with no programming experience who want to learn Ruby as their first programming language, and veterans who want to add Ruby to their programming toolkit. Cooper's response to this challenge is a solid entry in the limited arena of Ruby tutorials. Even though the early chapters are marred by the occasional reference to an advanced topic, readers will appreciate the plentiful examples and thoughtful description of the Ruby language." Read below for the rest of Tim's review. Beginning Ruby: From Novice to Professional author Peter Cooper pages 631 publisher Apress rating 7 reviewer Tim Hunter ISBN 1590597664 summary An introduction to Ruby programming

Ruby is an object-oriented programming language in the same family as Perl and Python. Ruby is very popular for writing web applications but also widely used for the general-purpose programming tasks. Ruby is available for Linux, Mac OS X, and Microsoft Windows. It is Open Source software with a commercially friendly license.

I agreed to review this book in particular because, even though the Ruby community has a strong tradition of encouraging newcomers, there are actually very few resources for the Ruby beginner. Ruby has gained a repuation for being easy to learn and therefore is attractive to people with limited or no programming experience. Novice programmers post almost daily requests for help and direction to the ruby-lang mailing list.

In addition to serving people with no progamming experience, Beginning Ruby is also aimed at experienced programmers who want to learn Ruby. Progammers coming from languages such as Java or C++ often struggle with Ruby's dynamic typing and (even with the recent explosion of Ruby-related books) the relative scarcity of documentation. Beginning Ruby tries to satisfy this audience by explaining Ruby's design, history and place in the programming world and including an extensive survey of the currently-available Ruby libraries.

Beginning Ruby is divided into 3 parts. The first part is aimed at neophytes. Experienced programmers, especially those experienced with object-oriented programming, will be able to skip chapter 2 and skim chapters 3 and 4.

The book starts simply. Chapter 1 isn't even about programming. This chapter explains how to install Ruby on Windows, OS X, and Linux. The instructions are thorough and aimed squarely at beginners. For example, Cooper explains how to get a command prompt on Windows and how to run Terminal.app on OS X.

Chapters 2 and 3 introduce fundamental concepts such as variables, expressions, control flow, classes, and objects. Cooper emphasizes experimentation. He says that irb, Ruby's interactive programming module, "provides the perfect environment for tweaking and testing the language, as you cannot do any real damage from within irb." Such assurances are helpful, especially to the beginner who may be slightly afraid that he's going to somehow make a mistake that will "break" his computer.

Explaining programming to beginners is hard. I've read a number of books that try to teach object-oriented programming concepts to people with no programming experience whatsoever. None were stunningly successful. This one isn't either. The problem is that books are linear, but there are simply too many things – concepts, keywords, tools – that have to be introduced nearly simultaneously and initially taken on faith. Cooper distracts his readers by peppering his text with too many "don't worry about this yet" disclaimers and assurances that explanations will appear later. His references C and Perl will be meaningless and possibly confusing to the beginning programmer.

Chapter 4, "Developing a Basic Ruby Application," starts by explaining what a text editor is and offering a few recommendations for text editors on Windows, OS X, and Linux. Then it guides the reader through his first real program, a script to read a text file and compute simple statistics such as the number of lines and words. This is a well-chosen example that will, when completed, make the student feel like he's accomplished something.

Chapter 5, "The Ruby Ecosystem," feels out-of-place. This chapter doesn't teach anything about Ruby programming. Instead it explains Ruby's history, introduces Ruby On Rails, and talks about the Open Source movement. Little, if any, of this material will be interesting to a fledgling programmer. The chapter finishes with a list of internet-based Ruby resources such as mailing lists, IRC, and blogs. All of this seems much better suited as an appendix and indeed the list of resources appears again in Appendix C.

Part 2, "The Core of Ruby," has a slower pace. With the very basic material covered, Beginning Ruby gets a better footing. Starting in this part the material is useful to both beginners and veterans.

This is probably as good a place as any to talk about the examples, which are numerous and very likely the best part of the book. Most of the the examples are short and to the point. A few extend over several pages. My overall impression is that they are well-chosen and well-coded. I especially like the way the examples appear on the page, visually distinctive but without interrupting the flow of the text. Source code for all of the examples may be downloaded from the Apress web site. However, even though the files are divided into a directory per chapter, the examples aren't numbered in the text so it's difficult to find the code for the example you're looking at. I ended up using grep to search for keywords in the sources.

Chapter 6 is a slower pass through Ruby, focusing on Ruby's object-orientation. Though fewer than part 1, there are still problems with references to concepts that have not yet been introduced. For example, Cooper uses the require method in the context of namespaces even though require has not been introduced. Indeed, it's not even necessary to mention namespaces at all in this chapter since the entire concept could've been held off until the next chapter, which explains how to create programs from code in multiple files.

The remaining chapters in this part start to address the needs of the serious Ruby programmer. This is a lot of ground to cover, including documentation, debugging, test-driven development, I/O, databases, and how to deploy Ruby programs. I particularly liked Cooper's thorough instructions for installing and creating RubyGems, Ruby's third-part library management system. There are so many topics to cover that each one gets only an introduction, but Cooper uniformly provides links to extended online documentation.

The last chapter in this part works through an even larger example, a Ruby "chat bot." This is an ingenious and entertaining example, the kind of program that, had I read it when I was just starting to learn programming, would have spent many happy hours tweaking. Call me a geek, but I got a chuckle out of the example on page 383 of two very stupid bots conversing.

Part 3 is called "Ruby Online." Of course it starts with the obligatory chapter on Ruby on Rails. I suppose publishers require such a chapter in all Ruby books, even though RoR is more than amply covered by other excellent books. I'm not a RoR programmer so I blew off this chapter.

Chapter 14 describes Ruby's support for the Internet via its HTTP, email, and FTP libraries. Chapter 15 covers other networking support libraries. As usual there are many excellent examples. Chapter 16 is a very good survey of the standard and add-on libraries that the serious Ruby programmer will find useful. Each library is demonstrated with an example, and Cooper provides a link to the complete documentation.

At the start of this review I said that Beginning Ruby is divided into 3 parts, but actually there are four. The last part consists of 3 appendices. Appendix A is a summarization of Part 2. Appendix B is sort of a "semi-reference" to Ruby's core libraries. This is not intended to be a complete reference. Instead, Cooper limits his discussion to the most useful methods of the core classes. As I mentioned earlier, Appendix C is a list of Internet-based Ruby resources such as web pages, mailing lists, IRC channels, and blogs.

I'm giving Beginning Ruby a 7. It's a good book for someone who wants to learn Ruby as his first programming language. It could be better. I liked Cooper's patient and thoughtful explanations about installing Ruby and RubyGems, how to use a command line, and what a text editor is for. Cooper supplies answers to all the typical Ruby-nuby questions, but his explanation of basic concepts is marred by the occasional confusing reference to advanced or even irrelevant topics. For the experienced programmer who learns best by reading and working through examples this book is a good choice. Dave Thomas' Programming Ruby, The Pragmatic Programmer's Guide (a.k.a. the Pickaxe) is a tough competitor, but each book has a considerable amount of material that is not found in the other book. For example the Pickaxe's core library reference is exhaustive but it has only a limited amount of the kind of tutorial explanations that is Beginning Ruby's strength. Beginning Ruby is available in PDF format from Apress' web site at about half the price of the paper book.

I have been programming Ruby as a hobby for over 5 years. Apress gave me a review copy of this book, but otherwise I have no connection to the author or publisher."

You can purchase Beginning Ruby: From Novice to Professional from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

172 comments

  1. Re:Ruby as a first language? by shagymoe · · Score: 4, Funny

    I started with Perl...I'll probably never recover from that.

  2. Re:Ruby as a first language? by EveryNickIsTaken · · Score: 1, Informative

    Uh, right. Go ahead and mod me down. Apparently "I disagree with you" is now used for -1 point "Troll." The bottom line is, no newb to programming is going to pick this is their first.

  3. Re:Ruby as a first language? by solevita · · Score: 3, Informative

    Uh, right. Go ahead and mod me down. Apparently "I disagree with you" is now used for -1 point "Troll." The bottom line is, no newb to programming is going to pick this is their first.
    You didn't really argue your point, apart from saying "puh-leaze", so it's hard to describe your post as anything other than trolling. Maybe flamebait, I guess.

    I'm seriously considering starting programming with Ruby and plan to look on Amazon later this evening for this book. Do you have any eloquent reason why I shouldn't?
  4. Re:Ruby as a first language? by shagymoe · · Score: 1, Insightful

    Maybe the problem is that, like a troll, you didn't give any good reason for your assertion that ruby is a bad language to start with. (assuming that puh-leese is an assertion.)

    Personally, I could never go back to perl, java or php from ruby, so it that is the case, why not bother starting with ruby?

  5. Slownewsday by Anonymous Coward · · Score: 0

    Come on.. a slashotisement on ruby, what we all need. How about some Macotisement while we're at it?

    1. Re:Slownewsday by Anonymous Coward · · Score: 0

      "Peter Cooper's Beginning Ruby: From Novice to Professional has two audiences, novices with no programming experience who want to learn Ruby as their first programming language, and veterans who want to add Ruby to their programming toolkit"

      You know slashdot is a nerd news site right? People who tend to know what "novice" and "professional" mean without needing you to redefine the title of the book.>/p>

  6. Re:Ruby as a first language? by Anonymous Coward · · Score: 1

    Why not? It is an acceptable LISP after all.
    Combine the approaches of try ruby! and the Purple Book, and you can't really go wrong.
    Now all we have to do is wait for such a book. Finished with pickaxe flavoring.

  7. When you step back and consider history by smittyoneeach · · Score: 3, Interesting

    How many different programming tools do we need?
    Wouldn't a venn diagram of key language features show substantial overlap?
    Ruby sounds like your typical well-done tool, which clearly has its audience.
    The only substantial criticism of Ruby I've ever heard is here:
    http://ciaranm.org/show_post/110
    Still, I'm wondering, what is the Next Big Thing? Is Python3000 going to rule the day? It's obviously 500 times better than Perl6. Then again, you've another round of C++ coming up for standardization: will svelte compiled languages recover some of the mindshare lost to these SUV scripting languages?
    Is the point of making some new tool the buzz of the day simply to sell books?

    --
    Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
    1. Re:When you step back and consider history by Anonymous Coward · · Score: 0

      Perl 6? I've been waiting for, what, 10 years? At least 7 or 8. Even if it's released, nobody will use it because it's not backwards compatible. To much "legacy" Perl 5 is holding the internet together. Larry must be smoking some mighty fine crack.

    2. Re:When you step back and consider history by tyler.willard · · Score: 1, Insightful

      "...svelte complied language..."

      What is that even supposed to mean? Especially vis-a-vis C++; the next round of standardization is considering adding GC and threading.

      Let's even go a bit further, what is "compiled"?

      Does a VM count? How about JIT'd code?

      No, just native you say?

      Then how about the fact the IA-32 instruction set ain't exactly native anymore?

      This old cannard that dynamic runtime-based languages are somehow intrinsically inferior to native binaries is ridiculous. It's the same tired "I am t3h 1337 and neeh 100% control" argument that was wrong when it was used for arguing about assembler vs C*.


      *OK, before optimizing compilers got decent it was true...but only for a little while.

    3. Re:When you step back and consider history by smittyoneeach · · Score: 1

      The fascinating thing about P6 is the amount of Haskell cross-pollinization at work.
      But if Ruby is a better Perl, will P6 be a redder Ruby?

      --
      Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
    4. Re:When you step back and consider history by dthable · · Score: 1

      It wasn't all Larry. He assembled a committee of users and decided to attempt to create algol-2000.

    5. Re:When you step back and consider history by hutchike · · Score: 1

      That's a very interesting criticism you include about Ruby's threading model. If anything, it's a reason to move to JRuby with its much better Java threading.

      --
      Zen tips: Pay attention. Don't take it personally. Believe nothing.
    6. Re:When you step back and consider history by jma05 · · Score: 1

      > Is Python3000 going to rule the day? It's obviously 500 times better than Perl6

      Python 3000 is a cleanup of the inevitable evolutionary accretions that languages accumulate. Nothing ground breaking in this release feature-wise. So Python 3000 and Perl 6 are very different in scope. I (as a Python user), for one am very curious of what will come out of Perl 6.

      There is a big list at
      http://dev.perl.org/perl6/faq.html

      The ones I am interested are
      explicit strong typing (Python 3000 - optional interfaces)
      coroutines (Python 2.5)
      macros (debate in Python but bigwigs don't like them)
      user-definable operators

      Since Perl and Haskell (Pugs) seem to have been dating for a while now, it is curious to see how the shabby blue collar man that is Perl will be transformed by the dainty, complex and academic girl that is Haskell.

    7. Re:When you step back and consider history by arevos · · Score: 2, Insightful

      How many different programming tools do we need?
      Wouldn't a venn diagram of key language features show substantial overlap? Sure, but that's not to say they overlap in the same places. I've never come across two programming languages with exactly the same strengths and weaknesses.

      Ruby sounds like your typical well-done tool, which clearly has its audience.
      The only substantial criticism of Ruby I've ever heard is here Bah, you're obviously not looking hard enough :)

      You can write pages on criticism on any language. For instance, you could criticise Ruby on it's efficiency, it's dynamic typing, it's syntax quirks, it's libraries, it's readability, it's method naming conventions... The list is substantial, and many people disagree whether certain features are advantageous or disadvantageous (the classic example is dynamic vs. static typing). In fact, I'd say you don't really know a language until you can point out it's flaws.

      Still, I'm wondering, what is the Next Big Thing? Whatever it is, I'm hoping it will be functional ;)
    8. Re:When you step back and consider history by Anonymous Coward · · Score: 0

      Even if it's released, nobody will use it because it's not backwards compatible. To much "legacy" Perl 5 is holding the internet together.

      I suppose you mean the same way that no-one uses Python or Ruby because they're not compatible with all that legacy Perl code. Idiot.
    9. Re:When you step back and consider history by krowe+(LinuxZealot) · · Score: 1

      "I am t3h 1337 and neeh 100% control" hmm, never heard that argument before (maybe I'm too young). How exactly could someone argue that C doesn't allow the control that ASM does when C allows asm code blocks? Did C not always allow asm code blocks?

    10. Re:When you step back and consider history by renoX · · Score: 2, Interesting

      Its support of Unicode should probably be added to the list of Ruby's quirks

    11. Re:When you step back and consider history by tyler.willard · · Score: 1

      Mainly, the argument was that you didn't know what kind of code the compiler was going to emit. The thought was that with assembly you could be sure that you got tight fast code.

      Even though overblown IMO, the footnote in my comment above concedes that for a period of time optimizing compilers weren't that great. That changed though, optimizers became, and are now, quite good.

    12. Re:When you step back and consider history by Gunark · · Score: 1

      Regarding the valid criticism (slow threading), you'll be happy -- or at least indifferent -- to hear that as of 1.8.6 ruby has native threading (referred to as fastthread by rubyists).

    13. Re:When you step back and consider history by chromatic · · Score: 1

      Since Perl and Haskell (Pugs) seem to have been dating for a while now, it is curious to see how the shabby blue collar man that is Perl will be transformed by the dainty, complex and academic girl that is Haskell.

      Perl 6 already had many of the interesting features of Haskell in one form or another (though usually not the purely-functional form) before Pugs existed. One notable exception is STM.

    14. Re:When you step back and consider history by Bill+Dog · · Score: 1

      Still, I'm wondering, what is the Next Big Thing?

      I don't know, but the Next Big Thing That Really Matters will be some kind of language that brings concurrent programming to the great unwashed masses. Until then there may very well be a few more essentially redundant languages (only minor leaps in productivity, nothing major) that go in and out of vogue.

      will svelte compiled languages recover some of the mindshare lost to these SUV scripting languages?

      No. The days of compiled languages as mainstream are over -- "SUV languages", interpreted, garbage-collected, are here to stay. The programmer base is moving away from having the skills and aptitude to keep their pointers straight, and to be able to debug native code. Just like I never learned how to write large applications solely in asm, "svelte languages" are now the skills of a passing era.

      --
      Attention zealots and haters: 00100 00100
    15. Re:When you step back and consider history by shutdown+-p+now · · Score: 2, Informative

      Sure, but that's not to say they overlap in the same places. I've never come across two programming languages with exactly the same strengths and weaknesses.
      There are plenty of pairs where difference are marginal, though. Say, C# and Java.

      Whatever it is, I'm hoping it will be functional ;)
      C# has first-class functions and lambdas already, and will get neat syntax for them in v3.0. Java is going to get lambdas in the next version. Even C++0x is going to get something similar, though not with true closure semantics. You don't have to wait for the Next Big Thing for functional stuff - it's already here, in the mainstream languages. It just doesn't look as neat as Haskell does, but you shouldn't care all that much about the looks.
    16. Re:When you step back and consider history by smittyoneeach · · Score: 1

      No. The days of compiled languages as mainstream are over -- "SUV languages", interpreted, garbage-collected, are here to stay. The programmer base is moving away from having the skills and aptitude to keep their pointers straight, and to be able to debug native code. Just like I never learned how to write large applications solely in asm, "svelte languages" are now the skills of a passing era.
      I like your point, but I'm coming to the conclusion that there is a standard normal distribution of tools and the skill level required to use them. There may be more growth in the left tail for crayon-level tools, and a bulge in the middle for these "SUV languages", but the bulk of those "SUV languages" are going to remain implemented in something like C/C++.
      Thus, the curve itself will be constructed with tools from the right tail, by people who develop the skill to play there.
      --
      Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
    17. Re:When you step back and consider history by Hyperspite · · Score: 1

      Why is this guy at -1? Seems like some mod has an agenda >.>.

    18. Re:When you step back and consider history by grumbel · · Score: 1

      ### The only substantial criticism of Ruby I've ever heard is here:

      Another issue Ruby and many other 'scripting' languages have is lack of lexical scoping. I just don't understand where there is a benefit of not declaring variables properly, it not only makes the scope of a variable rather unclear it also makes automatically catching errors much harder. A little "var a = 5" isn't much more to type then "a = 5", but its a hell of a lot more expressive. Ruby does a ton of good stuff, in fact its the languages that comes closed to "perfect", but those automatic variable declarations really drive me nuts from time to time.

    19. Re:When you step back and consider history by grumbel · · Score: 1

      ### Whatever it is, I'm hoping it will be functional ;)

      So do I, I just hope that they manage to create a functional language till then that is actually easy on the eyes. Currently they often try to be a little to clever for their own good.

    20. Re:When you step back and consider history by Anonymous Coward · · Score: 0

      bad posting history. the guy's an idiot at politics if not at CS.

    21. Re:When you step back and consider history by arevos · · Score: 1

      C# has first-class functions and lambdas already, and will get neat syntax for them in v3.0. Java is going to get lambdas in the next version. Even C++0x is going to get something similar, though not with true closure semantics. Does that include tail call elimination?

      You don't have to wait for the Next Big Thing for functional stuff - it's already here, in the mainstream languages. It just doesn't look as neat as Haskell does, but you shouldn't care all that much about the looks. Sure, this is all a step in the functional direction, but I was rather hoping for a more than just a single step. Since you mention Haskell, you'll probably be aware it contains a lot of functionality that is difficult or impossible to reproduce in a language like C# or Java.
    22. Re:When you step back and consider history by Bill+Dog · · Score: 1

      But like you said initially, how many different programming tools do we need? Most are already written, and more and more of any new tools will be written in the "SUV languages" themselves. E.g. the Eclipse IDE. Or e.g. Java XML or SOAP libraries, which are written in Java itself.

      Very little demand for the native-code-wrangling capable means colleges won't teach it and kids won't want to learn it, so that tail is essentially going to shrivel and fall off, as the older of its makeup retire, and those with still lots of time left in their working life, like me, switch to "SUV languages" (or go into management) to stay marketable.

      Maybe a bell curve will persist, but with everything shifted to the right, so that while the right tail was once "svelte language" skills, it will become comprised of the advanced users of "SUV languages", like people who know how to tweak their VM (using its "SUV language").

      --
      Attention zealots and haters: 00100 00100
    23. Re:When you step back and consider history by shutdown+-p+now · · Score: 1

      Does that include tail call elimination?

      No idea in either case. C++ standard certainly doesn't guarantee it, but IIRC, most optimizing compilers (and GCC in particular) try to perform it already. Java, I don't know. More likely for C#, since CIL already has a special bytecode for optimized tail calls.

      Sure, this is all a step in the functional direction, but I was rather hoping for a more than just a single step.

      Technically, first-class functions are all that is needed to consider the language functional. Pragmatically, it's more like "convenient first-class functions". There are a few other things traditionally associated with functional languages, true - type inference and pattern matching, in particular. Limited forms of type inference are already getting accepted in mainstream - "auto" in C++0x (a pity it was restricted to local variables in the end though, the original proposal allowed it in function arguments and result types as well) / "var" in C# 3.0 are pale shadows, of course, but type inference for lambdas in C# 3.0 is already pretty complicated.
    24. Re:When you step back and consider history by arevos · · Score: 1

      No idea in either case. C++ standard certainly doesn't guarantee it, but IIRC, most optimizing compilers (and GCC in particular) try to perform it already. Java, I don't know. More likely for C#, since CIL already has a special bytecode for optimized tail calls. I didn't know GCC optimised that, though it would appear you're certainly right! I don't think tail call elimination is planned for Java (from what I've heard), and I haven't heard it being introduced into C#. I guess it's possible though, since as you say it's supported by CIL, although so far as I know only functional languages like F# etc. use it.

      Technically, first-class functions are all that is needed to consider the language functional. Pragmatically, it's more like "convenient first-class functions". There are a few other things traditionally associated with functional languages, true - type inference and pattern matching, in particular. Functional programming is a programming style that attempts to minimise side effects, and whilst first-class functions et all are steps to ensuring that goal, C# still encourages an imperative style, and many common classes and methods in the .NET libraries produce a lot of side effects when called.

      For instance, if I call the Add method on the array ArrayList in C#, it updates the data in the ArrayList with a new value. If I were to add an element to a list in Haskell, a new list would be returned; the original list would not be altered (indeed, in languages like Haskell, it literally cannot be altered).

      I favour the functional approach, since it makes programs easier to test and verify. In a pure functional programming language, I know that for any arguments I pass into the function, I'll always get the same return value. Perfect for unit testing, and other verification methods.
    25. Re:When you step back and consider history by shutdown+-p+now · · Score: 1

      For instance, if I call the Add method on the array ArrayList in C#, it updates the data in the ArrayList with a new value. If I were to add an element to a list in Haskell, a new list would be returned; the original list would not be altered (indeed, in languages like Haskell, it literally cannot be altered).
      I know what pure functional approach means; but it's just not practical for the vast majority of applications - we can't optimize it nearly as well as the more conventional imperative style. That's why you see more programs written in O'Caml than Haskell, for example. Haskell is great as a language to learn what FP is about, but pure functional programming certainly won't be the next big thing, not in the next few years at least.
    26. Re:When you step back and consider history by smittyoneeach · · Score: 1

      Very little demand for the native-code-wrangling capable means colleges won't teach it and kids won't want to learn it
      Disagree. You overlook: a) curiosity, b) the fact that there will always be a need to squeeze a little more love out of existing configurations, and c) somebody has to know how to bring the box up from cold iron: even if you park the SUV in ROM, you still have to know how to build/maintain the SUV, d) there is much loot to be earned knowing b) and c)
      --
      Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
    27. Re:When you step back and consider history by arevos · · Score: 1

      I know what pure functional approach means; but it's just not practical for the vast majority of applications - we can't optimize it nearly as well as the more conventional imperative style. That's why you see more programs written in O'Caml than Haskell, for example. Haskell is great as a language to learn what FP is about, but pure functional programming certainly won't be the next big thing, not in the next few years at least. Pure functional programming eliminates all side effects. More pragmatic forms of functional programming only attempt to minimise it. This is why I don't consider C# to be a very functional language, because it doesn't really attempt to minimise side effects. C#'s style is still very imperative.

      Regarding optimization, I think you'd be surprised at how much pure functional languages can be optimized. If you compare the benchmarks of pure languages like Haskell or Clean again impure languages like OCaml, you'll get comparable performance. Clean even manages to outperform OCaml on average, according to the Computer Language Shootout.

      However, I agree that pure functional languages are unlikely to gain much ground for a few years at least. But hopefully we'll see side-effect functions slowly, slowly falling out of fashion the next decade or so, or at least have some way of partitioning them from stateless functions. C# is a long way off from doing anything of the sort.
  8. Re:Ruby as a first language? by Anonymous Coward · · Score: 0

    I started with Perl...I'll probably never recover from that.

    rotfl :) me too, I know what you mean :)
  9. Re:Ruby as a first language? by EsbenMoseHansen · · Score: 4, Insightful

    I know (as in, have written a substantial amount in) perl, java, ruby, C++, C, and (god forbid) PL/I. I am acquianted with quite a number more (like Haskel, Lisp) And have no fear, ruby is a fine language to start with. Especially the irb shell is very nice for getting your bearings, and the functional support will be good for you if you ever turn to the hardcore languages, like Haskell, C++ and that ilk. On the other hand, if you prefer the more limited languages, like Java, you will still have a good idea about most concepts you'll find. The only thing you will not learn that are common is static overloading and type checking, which is easy enough to pick up.

    Good luck. Learning to code and coding is very rewarding :)

    --
    Religion is regarded by the common people as true, by the wise as false, and by rulers as useful.
  10. Re:I would rather have.... by Archangel+Michael · · Score: 3, Funny

    I prefer Python on Fixed Wing Aircraft.

    --
    Agent K: A *person* is smart. People are dumb, stupid, panicky animals, and you know it.
  11. Re:Ruby as a first language? by mhall119 · · Score: 2, Funny

    Me too, but strangely I think it helped more than it hurt. By the time I was fluent in Perl, every other language seemed easy to grasp. It also taught me proper object-oriented programming by punishing me mercilessly for having a poor design. I guess it's kind of like the school of hard knocks for programmers.

    Positive reinforcement is for spoiled Ruby programmers.

    --
    http://www.mhall119.com
  12. Re:Ruby as a first language? by b0r1s · · Score: 1

    I started with Java, havent used it since :)

    Of course, as beginner languages go, Java was great - fantastic for teaching OO fundamentals.

    --
    Mooniacs for iOS and Android
  13. Enlighten me by pimterry · · Score: 4, Insightful

    Why is Ruby suddenly the big buzz these days? My internets inform me it's a high level server-side language (python for websites). Isn't the most important thing in a server side language fast performance rather than quick development time? I found an article on coding horror in the depths of my RSS reader talking about how Twitter are having no end of problems scaling their system, as they're using Ruby and it just isn't made for big, high traffic sites.
    If the main reason for writing server side software is web based applications, or at least dynamic content, isn't a huge factor in this how well it scales? Nobody makes sites to be used by 20 people.

    Finally, if anybody can explain it's popularity to me, should I learn it? I'm currently doing freelance web dev mostly in PHP, would it be useful? How? In my spare time I'm writing a AJAX web app with PHP back-end at the moment and it's mostly for my personal use (task tracking from anywhere), is Ruby good here with the limited audience the site'll have?

    1. Re:Enlighten me by plams · · Score: 4, Informative

      Ruby isn't any more a server-side language than 68k assembler is. You've probably confused it with Ruby on Rails which is a framework (and an excellent one, I might add) for making websites. Compared to plain PHP it makes web development easy and fun and even supports stuff like AJAX out of the box.

    2. Re:Enlighten me by Nafai7 · · Score: 2, Insightful

      I've been doing PHP programming for years, and I really enjoyed working with it as a scripting language.

      That said, I started playing around with Ruby on Rails. Honestly, simple tasks like database access is so much simpler to handle in RoR it's just amazing. Creating database driven web sites, with one-to-many and many-to-many relationships is at least 10x quicker than in PHP. You have to get used to the MVC style of programming of course.

      I'm still doing PHP at work, but at some point will push for a switch. Check this out to see a very simple walkthrough of creating a simple web site.

      Just a fan, in no way am I involved with the Ruby on Rails project itself.

    3. Re:Enlighten me by BrewerDude · · Score: 4, Informative

      Hi

      First, Ruby != Rails. Ruby is the programming language. Rails (or Ruby on Rails) is the web development framework. Ruby has been around a lot longer than Rails, but has certainly had it's popularity boosted by the buzz surrounding Rails.

      Second, I'd disagree that system performance is the biggest factor is selecting a web framework. Rails out of the box will support the load more most websites. There are many things that you can do to tune performance once you start getting enough page views for it to matter: caching pages, selectively replacing ActiveRecord's queries with raw SQL, etc. There are also people starting to focus on rails performance both from a developer's standpoint (e.g., the Rails Express Blog) and from the hosting standpoint (e.g., Engine Yard).

      To me, the first and foremost goal of building a website is to get the functionality there quick in order to attract users. Once you've got that, and have rapidly been able to iterate to what the users want to see, then you can start worrying about performance. And, if your site really makes it big, you are going to have to do custom tuning work no matter what framework you've chosen.

      Personally, I've found Rails to be a wonderfully productive framework to use for web development

    4. Re:Enlighten me by lewp · · Score: 2, Insightful

      Isn't the most important thing in a server side language fast performance rather than quick development time?

      Of course not. If it were, every high traffic website would be an NSAPI/ISAPI/Apache module. The vast majority of small to medium scale web apps are database limited much more than they are CPU limited on the web server. Twitter is such an app, as that coding horror article eventually mentions.

      As far as whether you should learn it, I get paid to write mostly PHP, and I'd say anybody else in my position should check Rails out just to compare and contrast. If anything, you might pick up a few tricks. I use Rails, and like it, but like any other tool it's not for everything. When I don't use it, I still find myself using Rails-esque constructs in my PHP/Java/whatever web apps, just because they get a lot of things right architecturally.

      --
      Game... blouses.
    5. Re:Enlighten me by pimterry · · Score: 1

      Yep. Smoothly done on my part.
      Sorry =P.

    6. Re:Enlighten me by pimterry · · Score: 1

      I'd like to apologise for being a damn fool with no idea what he's talking about.

      Ruby != Rails. Who'd of guessed it.

    7. Re:Enlighten me by CastrTroy · · Score: 4, Informative

      PHP isn't a framework. It's a programming language. You made the same mistake your parent did. You're comparing a framework (RoR) to a langauge (PHP). If you want to compare them, you'll have to compare it to another framework, like CakePHP.

      --

      Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
    8. Re:Enlighten me by rainman_bc · · Score: 2, Interesting

      OT, but I find a lot of people blur the distinction - they have only heard of Ruby in the context of Ruby on Rails, which is great, but Ruby itself is a fantastic language for all sorts of scripting - a better Perl than Perl, a better Python than Python...

      --
      09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
    9. Re:Enlighten me by misleb · · Score: 1

      Finally, if anybody can explain it's popularity to me, should I learn it? I'm currently doing freelance web dev mostly in PHP, would it be useful? How? In my spare time I'm writing a AJAX web app with PHP back-end at the moment and it's mostly for my personal use (task tracking from anywhere), is Ruby good here with the limited audience the site'll have?


      All I can say is that after doing PHP on and off for a few years and then learning Ruby, I never want to touch another line of PHP shite again. Sorry, if this sounds like I'm trying to start a flame war, but PHP is just a dumb language. Sure, it works, it is easy to learn, can find hosting for it anywhere, but it is just braindead. That and the gawd aweful function naming problem. Things I can do with 2 or 3 lines of Ruby used to take me 10 lines in PHP. PHP is one of those languages where, if there is no fucntion to do exactly what you want, you can expect to take a fair amount of time implementing it youself. I have similar reaction to Perl after learning Ruby... although for different reasons. Perl is just plain ugly. Ruby's just so... pretty. :-)

      So yeah, I thnk you shuld give Ruby (particularly Rails) a try. I'm not normally one to go for trends (I'm a "Web 2.0" skeptic, for example). Ruby and Rails are the real deal. As long as you are willing to accept one fact up front: Ruby isn't as fast as other languages. It is a tradeoff. Save yourself weeks of dev time and let the computer do the heavy lifting.

      -matthew
      --
      "THERE IS NO JUSTICE, THERE IS ONLY ME." -Death
    10. Re:Enlighten me by Anonymous Coward · · Score: 1, Insightful

      I swear half the posts supporting Ruby read like marketing department press releases.

      Anyone know who is behind Ruby and who is paying for all these posts and slashvertisements? And why?

    11. Re:Enlighten me by crayz · · Score: 1

      My guess is: no one. Ruby is simply a great, enjoyable language. Have you actually used it yourself? I'm YA PHP->Ruby/Rails convert. Looking back to PHP code now makes me feel ill

    12. Re:Enlighten me by arevos · · Score: 2, Insightful

      Isn't the most important thing in a server side language fast performance rather than quick development time? Only if you need performance. Not every dynamic site on the web needs to serve a bazillion people a day, and throwing hardware at a problem is often far cheaper than employing a skilled software developer for longer.

      If the main reason for writing server side software is web based applications, or at least dynamic content, isn't a huge factor in this how well it scales? Nobody makes sites to be used by 20 people. No, but very few sites have to deal with 11000 page views per second, as Twitter reputedly does. Since Rails (just) handles this, then it should handle more modest needs as well.

      Also, the main problem Twitter has is the database bottleneck, not Ruby's speed (or lack thereof). Rails is designed to work around a single database, so clearly any web app that requires a dozen database servers in parallel is going to take a few specialised plugins or patches to achieve.

      Finally, if anybody can explain it's popularity to me, should I learn it? I'm currently doing freelance web dev mostly in PHP, would it be useful? How? In my spare time I'm writing a AJAX web app with PHP back-end at the moment and it's mostly for my personal use (task tracking from anywhere), is Ruby good here with the limited audience the site'll have? Try it :)

      Ruby's pretty good with AJAX, since it integrate Prototype and Scriptaculous functions into lots of easy helper functions. It also helps do away with a lot of boilerplate code when accessing a database.
    13. Re:Enlighten me by DCastagna · · Score: 1

      Ruby is the interpreted language.
      These day you hear a lot about Ruby because of Ruby on Rails, a very good MVC framework based on Ruby.
      I love performance, but after trying Ruby on Rails I have to say that it is a great framework, even if it's slow.

      I think today is more important quick development time rather than fast performance, and I think that when you start having problem with the performance of RoR, probabibly you have enough users (and money) to buy better hardware and to spend some time scaling your webapp.

    14. Re:Enlighten me by DragonWriter · · Score: 1

      Why is Ruby suddenly the big buzz these days?


      Because its convenient for things people need to do, and the language at the center of a popular web framework.

      My internets inform me it's a high level server-side language (python for websites).


      Ruby isn't "python for websites". It would be closer to say its "python, but different". Sure, its most popular application is a web framework (Rails), but that's not the same thing as the language. Python has web frameworks like Rails too.

      I found an article on coding horror in the depths of my RSS reader talking about how Twitter are having no end of problems scaling their system, as they're using Ruby and it just isn't made for big, high traffic sites.


      As the follow-up makes clear, the issue that the author of that post was trying to raise was with the Rails framework. Anyhow, I don't think its a huge surprise that a site that is the biggest production site running a particular framework is running into performance problems. There've also been several posted techniques for dealing with the apparent source of the barrier to optimization (the lack of an easy way in Rails to connect to multiple databases) since this issue came to the attention of the community.

      If the main reason for writing server side software is web based applications, or at least dynamic content, isn't a huge factor in this how well it scales?


      Certainly, scalability is a big factor. But Rails scales well enough for plenty of systems that are in production. Yes, there are applications that push its present limits; of cousre, those are also the one's which promote new development.

      Nobody makes sites to be used by 20 people.


      Probably not. Then again, there are many sites with more than 20 users using Rails in production. And, again, Ruby is not just rails.

      Finally, if anybody can explain it's popularity to me, should I learn it?
      ::shrug:: If you want. I like Ruby, but I don't have any strong feelings about you learning it.

      I'm currently doing freelance web dev mostly in PHP, would it be useful?


      That probably depends on why you are using PHP.

      In my spare time I'm writing a AJAX web app with PHP back-end at the moment and it's mostly for my personal use (task tracking from anywhere), is Ruby good here with the limited audience the site'll have?


      This sounds like something that Ruby on Rails would be good at. But, whether its better for you than PHP is something you'll have to answer yourself. You might want to take a look at Agile Web Development with Rails, and see if RoR looks like it would be good for you.

    15. Re:Enlighten me by plams · · Score: 1

      I disagree. Parent asked about PHP vs. RoR, and it highlights an interesting tendency; sites written in plain PHP are a common sight whereas sites written in plain Ruby are not (compared to RoR-powered sites). Framework or not, they're each self-sufficient and popular approaches to web development.

    16. Re:Enlighten me by vacorama · · Score: 1

      ruby goes to great lengths to give the programmer the abiltiy to dynamically add/remove functionality to instantiated objects(not classes like java). if you look around for some ruby implementations of common design patterns, you'll see the real power. Theres no need for a pattern like 'strategy' in ruby, stuff like that just works by passing blocks to methods. ruby is geared more towards the way the brain works, not the way the computer does. The ruby philosphy is that speed issues will work themselves out with time (let the people designing virtual machines worry about that), and it's probably better to put programmer freindliness first. ['ruby', 'php'] - ['php'] # this would equal ['ruby']... lots of cool stuff like that.

    17. Re:Enlighten me by Paradise+Pete · · Score: 1
      I'm YA PHP->Ruby/Rails convert. Looking back to PHP code now makes me feel ill

      I'm working on my first real-world Rails project, while at the same time having to maintain the current PHP-version of the same thing. And the feeling I get when I have to go back to the PHP is amazingly similar to the feeling I get (and I don't mean for this to be flamebait) when I'm forced to use Windows. Yeah, I can get stuff done, but it just feels, well, icky.

    18. Re:Enlighten me by Anonymous Coward · · Score: 0

      Anyone welcomes the hell that comes from scaling problems. If the programming language helped you to exceed your expectations of success, that's a positive. I'd even stand by that if you're trying to scale up from MS Access. Good job designing a useful app if it outgrew it's intended use!

    19. Re:Enlighten me by Achromatic1978 · · Score: 1

      No, but very few sites have to deal with 11000 page views per second, as Twitter reputedly does.

      Not to doubt Twitter, but this would have it as the second most popular website on the net, behind Google: http://www.alexa.com/site/ds/top_500?&qterm=&p=Dev Corner, as MSN currently averages 9,700 page views per second (I should know).

      I'm slightly sceptical.

      That being said, I realize that Twitter's concept of page views is slightly different, and lighter than, MSN's.

    20. Re:Enlighten me by Achromatic1978 · · Score: 1

      Err, behind Yahoo. Damnit.

    21. Re:Enlighten me by arevos · · Score: 1

      Not to doubt Twitter, but this would have it as the second most popular website on the net, behind Google: http://www.alexa.com/site/ds/top_500?&qterm=&p=Dev Corner, as MSN currently averages 9,700 page views per second (I should know). I did some checking and you're probably right; according to this page the oft-quoted 11000 figure is a misquote, and apparently the true figure is closer to 600 requests per second.

      Oops! That's what happens when you don't check your sources, folks - my bad!

      Still, 600 requests per second is still a fairly heavy traffic throughput for Rails to scale to.

    22. Re:Enlighten me by krowe+(LinuxZealot) · · Score: 1

      If you like the ruby on rails concept but you are more familiar with PHP you would do yourself a favor to check out phpCake. It is basically Ruby on Rails using PHP instead of Ruby for its language. I am currently working on a big project using this framework and it has gone fairly smoothly. phpCake IS still fairly immature but already very usable for almost any website. Progress is coming along nicely and it isn't too far from being a very powerful PHP framework. Also, in reference to the main story, I taught myself how to program in C/C++ beginning at the age of 8 and I think it is probably the best language to learn with. I am surprised that no one else has said this. Why wouldn't you want to first learn the language that is the syntactical template that probably 80%+ of the other languages are based on? Remember that a newb isn't actually making a full featured application he is just playing around with the language. And the fact that it doesn't do much for you automatically means that you end up learning allot more about how the PC is actually working. Things like pointers and memory locations most language try to hide you from which is a good thing when developing real world applications but when you are learning I think it is good to be aware of these things. From my point of view the only real problems with learning in C/C++ is the fact that it takes a few more seconds to compile and sometimes the error messages can be a little cryptic. If I learned to program using Ruby I really don't think much of the syntax of most other languages would make much sense to me. I base this theory on the fact that when I look at Ruby code it seems very foreign to me even though I'm comfortable in a ton of other languages ranging from VB to PHP to ASM. Maybe it is because I learned in C/C++ that I have trouble reading Ruby code but whatever the reason I find it hard to believe that learning Ruby is going to help a newb as much when they go to learn other language other languages.

    23. Re:Enlighten me by fm6 · · Score: 1

      Well, I'm interested in Ruby because I'm sick of the whimsicalness of Perl, and Python is too ad hoc for my tastes.

    24. Re:Enlighten me by Anonymous Coward · · Score: 0

      Actually, PHP originally stood for Personal Home Page Tools, so it is kind of the primordial Web framework. OK, more of a domain specific language, but the comparison to Rails is not as improper as you imply. PHP was specifically made so that it would be easier to run code in templates and connect to the database than it was in Perl.

    25. Re:Enlighten me by TechnicalFool · · Score: 1

      Don't forget iterators. There's some lovely Perl-like convoluted code that you can do, if you're that kind of twisted.

      [[2, "another"], [1, "Just"]].concat([[4, "hacker."], [3, "Ruby"]]).sort{|a, b| a[0] b[0]}.each{|el| print el[1] " "} ...I think I've found my new signature.

      --
      09F9 1102 9D74 E35B D841 56C5 6356 88C0
    26. Re:Enlighten me by TechnicalFool · · Score: 1

      ..yay for /. doing things to what it thinks are tags. Put two less-than tags between 'el[1]' and '" "' for working code!

      --
      09F9 1102 9D74 E35B D841 56C5 6356 88C0
    27. Re:Enlighten me by Nurgled · · Score: 1

      PHP consists of both a programming language and a framework. I very shallow, "to the metal" framework to be sure, but still a framework. It provides features such as form submission parsing, cookie management and a concept of "sessions". CakePHP and friends add another layer of framework atop this existing functionality.

    28. Re:Enlighten me by alexo · · Score: 1

      > You made the same mistake your parent did.

      Must... Resist... Contraceptive... Joke...

    29. Re:Enlighten me by Anonymous Coward · · Score: 0

      Still broken.

  14. It would be a great first language by BrewerDude · · Score: 4, Insightful
    In my opinion, Ruby would make a great first language.

    Many computer science departments, including MIT, use Scheme as the language for their introductory computer science course. It's a wonderful language and helps the students learn a lot of key concepts that are important for formal computer science.

    Scheme, though, is a little hard to use for real-world work. Ruby, on the other hand, is a great real-world language that has many of the features that I miss from Scheme: closures, lambda expresions, etc.

    I haven't read this book, so I can't recommend it, but I can heartily recommend Ruby as a language that would be great to learn to program in. It'll let you focus on the key concepts rather than the tedium of implementing them in lower level languages.

    Go for it!

    1. Re:It would be a great first language by CastrTroy · · Score: 1
      Does a beginner programmer really need all those features? Personally, I started out using QBasic. I think it's a good idea to start off simple. You can't expect to know everything as soon as you start. I think it's a good idea to go in small steps. Something like:
      1. Learn about variables and doing simple math
      2. Learn about conditional statements
      3. Learn about looping structures
      4. Learn about functions
      5. Learn about classes/stuctures
      6. Learn about more advanced concepts
      Very few languages let you do the first three without worrying about classes and/or functions. If you pick Java as your first programming language you'll have to learn about classes and functions, even to just write your first hello world program. You won't have to know very much, but it's easier to grasp these concepts one at a time. Therefore, I find a good progression of languages to be Basic, C, Java (Or C#,VB.Net,any other OO Language).
      --

      Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
    2. Re:It would be a great first language by partenon · · Score: 2, Informative

      You can have 1, 2 and 3 in Ruby without knowing the others. And it would be a pleasant surprise to learn 4, 5, 6 and see that Ruby implemented 1, 2, 3 using them (OOP) :-)

      --
      ilex paraguariensis for all
    3. Re:It would be a great first language by Serious+Callers+Only · · Score: 2, Informative

      Very few languages let you do the first three without worrying about classes and/or functions. If you pick Java as your first programming language you'll have to learn about classes and functions, even to just write your first hello world program. You won't have to know very much, but it's easier to grasp these concepts one at a time. Therefore, I find a good progression of languages to be Basic, C, Java (Or C#,VB.Net,any other OO Language).


      I don't see why you think Ruby would make any of that difficult - perhaps you're getting Ruby mixed up with other languages, it's one of the better ones to learn with in my opinion. In the interactive ruby shell (irb) you can learn this stuff easily:

      1. Learn about variables and doing simple math

      irb > 2+2
      => 4
      irb > x = 3
      => 3
      irb > y = 2
      => 2
      irb > x + y
      => 5

      2. Learn about conditional statements

      irb > if (x > 2)
      irb > y = 10
      irb > end
      => 10
      irb > x + y
      => 13

      3. Learn about looping structures

      irb > 2.times do
      irb * puts "Hello world"
      irb > end
      Hello world
      Hello world

      irb > ["jan","feb","march","april"].each do | month |
      irb * puts month
      irb > end
      jan
      feb
      march
      april

      4. Learn about functions

      irb > def max(a,b)
      irb > if a > b
      irb > a
      irb > else
      irb * b
      irb > end
      irb > end
      => nil
      irb > m = max(4,8)
      => 8
    4. Re:It would be a great first language by BrewerDude · · Score: 1

      Agreed. Ruby lets you learn in that progression, BTW. Everything is an object, but you don't need to know the details of that day one, at least for simple types like you're describing.

    5. Re:It would be a great first language by Frequency+Domain · · Score: 1
      I think you're grabbing the wrong end of the question. From either an instructor or student's viewpoint the concern should be whether the language requires you to know all those features to do even simple programs. As you point out, Java requires a lot of overhead to write "Hello world". Ruby doesn't. The reason I think Ruby would be a good teaching language is that you can start small, but take it as far as you want with regard to OOP, functional programming, etc., all without having to switch languages along the way. Ruby keeps simple things simple, but the power is all there if you want to draw on it.

      You can criticize Ruby for its speed in the various shootouts, but even there I hearken back to the old saying "There are no slow languages, only slow implementations." Any runtime slowness is usually offset by reductions in my development time - I find it easier to prototype an idea in Ruby, then translate to Java/C++ if I need more speed, and for my work Ruby will cough up the answer within a second or two of run time 95% of the time. However, I do academic research with a lot of one-off code - your mileage may vary.

    6. Re:It would be a great first language by kiyoshilionz · · Score: 1

      As a young EE/CS student at UC Berkeley, I started out last semester with SICP - the MIT Scheme book. Like the ideas the rest of you folk are promoting, we were taught high level concepts using Scheme, then we took the language to learn more computer-sciency ideas such as writing evaluators/interpreters and understanding serialization.
       
      In regards to the "learn assembly and C first" comments, we learn C and Assembly in our third programming course in about a span of a month. Only a week and a half of C, and poof, you're expected to know it. They structure the progression Scheme -> Java -> C/Assembly/Logic gates because they want students to learn the general concepts/feel of writing code before going after the hard-to-read, older, procedural, strongly-typed stuff.

    7. Re:It would be a great first language by Frequency+Domain · · Score: 1

      As an MIT alum, I'm a big fan of SICP. However, not many curricula use it and a lot of people "don't get it." I'm not sure why you addressed your response to my earlier message, I wasn't one of the advocates of "learn assembly and C first". I'm saying that Ruby wouldn't be a bad choice for a first language because it doesn't bog you down in lots of overhead early on, but has enough richness that you can carry on with it through some very sophisticated concepts.

  15. Re:Ruby as a first language? by Anonymous Coward · · Score: 0

    Why exactly do people say that? Ruby is not terribly lisp like in any way. No macros, it has a terse context sensitive syntax, it's really kind of big where scheme and lisp are generally kind of small.

  16. Re:I would rather have.... by drix · · Score: 2, Informative

    Well, you're in luck.

    --

    I think there is a world market for maybe five personal web logs.
  17. Re:Ruby as a first language? by dthable · · Score: 1

    There will never be an acceptable lisp. No sane person designs a modern language that requires counting opening and closing parentheses until your eyes burn.

  18. Just too bad by Anonymous Coward · · Score: 0, Insightful

    Ruby is slower than pretty much everything, and using rails means committing to buying a supercomputer. The ruby community is the worst bunch of architecture astronauts ever.

  19. Re:Ruby as a first language? by iggymanz · · Score: 1

    there are editor tools that will do that and more for you, and not just for LISP

  20. Re:Ruby as a first language? by lewp · · Score: 1

    That's why God invented editors with brace matching. Stop using ed just because it's the standard.

    --
    Game... blouses.
  21. Re:Ruby as a first language? by dthable · · Score: 1

    FYI....it's a joke. I have used editors to write lisp and it's made my courses in AI and NLP so much easier but my fellow classmates still poked fun at lisp.

  22. Ruby astroturfing by zymano · · Score: 0, Troll

    It seems that there are people pushing ruby but for no purpose than to jump on something to sell books.

    What is the advantage of this language over PHP,python or Perl.

    It is extrememly slow. Terrible for high usage websites.

    Seems there are programmers who are in love with syntax and will trade speed for it. I would rather use CGI with C:Still the performance king,Java comes in 2nd and Perl 3rd.

    1. Re:Ruby astroturfing by plams · · Score: 3, Informative

      Define "high usage website". RoR-powered sites like 43 Things and ODEO don't seem like backyard hobby projects to me.

    2. Re:Ruby astroturfing by hyperstation · · Score: 0

      so, ruby handholds people who are to dumb to secure PHP properly and write readable code?

    3. Re:Ruby astroturfing by arevos · · Score: 1

      Python because white space does not affect logical flow in Ruby Yes, you can write unindented code in Ruby, but why is this an advantage?

      If you're going to discuss advantages of Ruby over Python, anonymous blocks and Ruby's class system would be better choices.
    4. Re:Ruby astroturfing by DragonWriter · · Score: 0

      Yes, you can write unindented code in Ruby, but why is this an advantage?


      The advantage is that it doesn't have Python's tab problem.

      If you're going to discuss advantages of Ruby over Python, anonymous blocks and Ruby's class system would be better choices.


      Well, yeah, those are advantages, too. Its hardly as if one advantage negates the others.
    5. Re:Ruby astroturfing by arevos · · Score: 1

      The advantage is that it doesn't have Python's tab problem. Sure, that's a problem, but not exactly a big one. You can solve it with a global search and replace if it ever crops up, whilst some of Ruby's problems are more difficult to get around. And the problem only crops up if you're copy-pasting code from a third party who shares different coding conventions to you.

      Well, yeah, those are advantages, too. Its hardly as if one advantage negates the others. Any problem that can be solved in five seconds by a decent editor is not much of a problem. Especially when it's compared against Ruby's performance, or should I say lack of it :)
    6. Re:Ruby astroturfing by dtolton · · Score: 1

      Once you are an experienced Python programmer it isn't a problem, but it can be a pain dealing with white space sensitivity while you are learning. The biggest problem is that the Python code will *look* right, but not execute.

      As an experienced programmer prior learning Python it only caused me mild heartache. I don't know how easy or hard it would be for a total newcomer to programming. If they are some of the people that were in my early CS classes, I'd say they'll never get past it without help.

      What problems in Ruby are you referring to that a newcomer will experience? In general, I wouldn't expect someone who is just learning to program to run into any serious difficulties with Ruby or Python (other than significant whitespace).

      --

      Doug Tolton

      "The destruction of a value which is, will not bring value to that which isn't." -John Galt
    7. Re:Ruby astroturfing by random0xff · · Score: 1

      C# 3.0 > *.* because it has learned from all (OOP, semi dynamic, sort of functional) and it's an ECMA standard. .NET adds a huge class library, but ASP.NET needs more flexibility, maybe an MVC alternative (I read that Scott Guthrie is working on a proof of concept).

    8. Re:Ruby astroturfing by DragonWriter · · Score: 1

      Sure, that's a problem, but not exactly a big one. You can solve it with a global search and replace if it ever crops up, whilst some of Ruby's problems are more difficult to get around.


      Such as...what? The two main complaints I've seen about Ruby features are (1) lack of good Unicode support, which is certainly can be a real problem with I18n, but isn't a barrier to its utility in learning to program, for sure; and (2) its "too slow", which, again, isn't a barrier to its utility in learning to program in it, though it may somewhat limit the applications it is suitable for.

      And the problem only crops up if you're copy-pasting code from a third party who shares different coding conventions to you.


      Something that newbie programmers are likely to do occasionally.
    9. Re:Ruby astroturfing by arevos · · Score: 1

      Such as...what? The two main complaints I've seen about Ruby features are (1) lack of good Unicode support, which is certainly can be a real problem with I18n, but isn't a barrier to its utility in learning to program, for sure; and (2) its "too slow", which, again, isn't a barrier to its utility in learning to program in it Well, I was talking generally, rather than just from a beginners point of view. However, from a learning perspective, personally I found Ruby's class model to be more difficult to grasp than Python's, and it still has some odd bits to it. It's more elegant, however, I'll admit.

      Ruby's syntax itself is also not as suited for a beginner, in my opinion, as there a lot of different ways to do the same thing. If you're learning by example, and each example employs a different technique, you have more to learn. Some other things that come to mind are the "and" and "or" boolean operators, which don't behave as one might expect they would; blocks have some scope issues that aren't immediately obvious; and leaving a method call unbracketed, whilst sometimes more aesthetically pleasing, can produce odd syntax errors.

      I'm sure there's a few more oddities in the language I've forgotten about.

      I'm not saying Ruby is a bad language, merely that it has its share of flaws, the same as everything else.
    10. Re:Ruby astroturfing by Dystopian+Rebel · · Score: 1

      Yes, you can write unindented code in Ruby, but why is this an advantage?


      That's a lawyerly-phrased question. I still indent code. I don't like my indentation preferences determining the logic of the code.

      If you're going to discuss advantages of Ruby over Python, anonymous blocks and Ruby's class system would be better choices.


      I personally like Ruby more than Python and in particular like the class system, notation, and its implicit accessors. But I'd call these preferences just that, whereas I consider "significant whitespace" to be folly.

      --
      Rich And Stupid is not so bad as Working For Rich And Stupid.
    11. Re:Ruby astroturfing by DragonWriter · · Score: 1

      Ruby's syntax itself is also not as suited for a beginner, in my opinion, as there a lot of different ways to do the same thing. If you're learning by example, and each example employs a different technique, you have more to learn.


      I'm not sure this is really a weakness as a language for beginners; certainly, there is more to learn before you've learned every way to do everything, but that also means that there are more different approaches (suited for different learners) that can be taken and still cover the same scope of what you can do. I don't see this as a weakness, generally, though it can produce gotchas in interpreting others code.
    12. Re:Ruby astroturfing by Anonymous Coward · · Score: 0

      I'm pretty sure that it's impossible to secure PHP properly, since they don't use SQL placeholders, so you will always be vulnerable to SQL injection attacks. Unless you've already thought of every possible injection attack and planned a way to defeat it.

    13. Re:Ruby astroturfing by hyperstation · · Score: 0

      actually, no. sql injection is easy to work around in PHP, it's just that a lot of (inexperienced) programmers fail to do so. anyhow, placeholders are done on the database side and is supported even by the most common database used with PHP, MySQL.

    14. Re:Ruby astroturfing by John+Nowak · · Score: 1

      As someone who writes mostly in Scheme, and hence doesn't even have significant line breaks and does (x ((y z) w)) all day, I can say that you're just plain wrong. Set your editor to spaces and you'll never see a problem. You just won't. Any decent editor backspaces over spaces as if they were tabs anyway, so it is completely transparent. Significant whitespace isn't the issue. What might be is a lack of good error reporting. I think if Guido were to start over, he'd disallow tabs completely, and simply error on the first leading tab encountered.

      You don't dislike significant whitespace. You're not ending every line with a semicolon. It's just a matter of getting over it, using it, and seeing that it is no big deal.

    15. Re:Ruby astroturfing by chromatic · · Score: 1

      You don't dislike significant whitespace.

      I dislike significant vertical whitespace, especially when combined with automagical variable scoping.

    16. Re:Ruby astroturfing by Koen+Deforche · · Score: 1

      CGI in C is too risky. CGI in C++ and STL strings is secure, scalable, and highly portable. I'd take Perl before Java for CGI. I prefer Python or Ruby to Java in just about every case, including UI development (WxWidgets). I agree with you, but why settle with CGI if you can get a Web Toolkit in C++ that is secure, scalable, and highly portable ?
    17. Re:Ruby astroturfing by Dystopian+Rebel · · Score: 1

      You don't dislike significant whitespace. Perhaps if Guido Van Nostrum repeats this to me 50 times I will be cured!

      It's just a matter of getting over it, using it, and seeing that it is no big deal. Semi-colons can be used in Python, as you know. I believe I could live without them, but I consider them useful in some circumstances.

      Ruby is just one example to show that a language can be readable without promoting Corporal Blankness to a three-star General.

      --
      Rich And Stupid is not so bad as Working For Rich And Stupid.
    18. Re:Ruby astroturfing by John+Nowak · · Score: 1

      Scoping is fucked in Python, it's true. It's the main reason I don't use it. Certainly a language like that nowadays should have proper lexical scoping? It isn't as if it is some pure message passing model that it makes sense not to have it.

    19. Re:Ruby astroturfing by arevos · · Score: 1

      That's a lawyerly-phrased question. I still indent code. I don't like my indentation preferences determining the logic of the code. Under what circumstances would you indent something in a different fashion to Python? I can't think of any instance, myself, but perhaps you can?
  23. I, for one... by harry666t · · Score: 0

    ...welcome our new Ruby beginners...

  24. first language by lordholm · · Score: 2, Interesting

    As a first programming language, if you are serious about programming, learn C or some Assembler, this will make you understand how a computer actually works and think before you write sucky code.

    I know Assembler, C, Obj-C, C++, Haskell, Bash, Java, Python, Matlab (or whatever that language is called) plus a few proprietary languages and toy/educational languages.

    Although, while I didn't start with C or Assembler (I started with C++ and felt it was a big piece of shit, though now days I find it quite useful; it is very abstracted though), this is certainly what I recommend for a person who is serious about programming.

    As a side note, it is interesting that at the school at which I took my MSc, they used Haskell as a first starting language, basically to tell everyone that "you don't know shit about programming" and bring the sufferers of the perfect programmer syndrome down to the ground. A very good thing indeed.

    Learn C or Assembler, and then learn Ruby, that is the way to go.

    --
    "Civis Europaeus sum!"
    1. Re:first language by misleb · · Score: 1

      The problem with learning assembler is that there seems to be very little you can do these days that has any usefulness. I'm one to learn a language by starting a project and just learning as I go. But what kind of project can you do with assembler? I'd actually like to know because I skipped ASM long ago because I just couldn't find a use for it.. especially in these days of protected memory and total hardware abstraction.

      That said, C is probably a good start. If only so you realize just how much time high level languages can save you. :-)

      -matthew

      --
      "THERE IS NO JUSTICE, THERE IS ONLY ME." -Death
    2. Re:first language by 0kComputer · · Score: 2, Insightful

      As a first programming language, if you are serious about programming, learn C or some Assembler, this will make you understand how a computer actually works and think before you write sucky code.

      Sucky in what way? Good code now days has more to do with structure and maintainability as opposed to squeezing every possisble extra CPU out of a procedure. Instead of wasting time learning C/assembler, which you probably wouldn't get any use out of, I would go with an OO language such as Java or .net. Stick to the high level languages, no matter what the code programming pursists say.

      --
      Top 10 Reasons To Procrastinate
      10.
    3. Re:first language by DragonWriter · · Score: 1

      Instead of wasting time learning C/assembler, which you probably wouldn't get any use out of, I would go with an OO language such as Java or .net.
      .net is not a language, but a platform, and if you are going to learn an OO language, why not learn Ruby?
    4. Re:first language by 0kComputer · · Score: 1

      .net is not a language, but a platform,
      oops, I meant to say C#. My bad.
      and if you are going to learn an OO language, why not learn Ruby?
      The problem that I have with Ruby is that it is not widely used. Most of the sample code and open source stuff out there is written with the more popular languages. Also, books, googling for ruby help, or posting to message boards and news groups isn't going to be as effective for the beginner OO type questions.

      --
      Top 10 Reasons To Procrastinate
      10.
    5. Re:first language by lordholm · · Score: 1

      I work a lot with embedded hard real time system, I have worked with full system simulation as well. Assembly is indeed very useful, especially when you try to figure out why the system is crashing only to in the end uncover code generation bugs in the customised version of gcc that was used to compile the embedded software.

      In any field you tend to learn the basics first and then move in to more abstract levels. Any programmer should grasp the physics of a transistor, how a CMOS circuit works, what gates and RTL level descriptions are used for.

      This does not necessarily mean that you should be an expert on these things.

      As you said if you know C, you understand how much time you can save with a higher level language. You should also understand when C is the right tool to use (and assembly as well), and when Ruby is.

      When I write a quick hack to test an algorithm I use Python, when I write code that MUST be fast and every cycle counts, in that case I would use C. C have some nice properties such as that you can actually look on the code and see what the asm output will be (if compiled with -O0).

      --
      "Civis Europaeus sum!"
    6. Re:first language by DragonWriter · · Score: 1

      The problem that I have with Ruby is that it is not widely used.


      That is a point. OTOH, It seems to me—though I wasn't a beginner when I encountered any of them—that its a lot more beginner-friendly of a language than Java or C#.

      Most of the sample code and open source stuff out there is written with the more popular languages.


      That's true, but I'm not sure all that volume is really necessary. There is certainly a "critical mass" of resources necessary for a language to make a good first language, but in the internet age there are very few languages of note that don't make that grade—at least one good introductory book (and both the one that is the topic of this thread and Chris Pine's Learn to Program seem to offer that for Ruby), a few more advanced ones, and an active community and you're off. Ruby seems to be good there.
    7. Re:first language by lordholm · · Score: 1

      It is not only about squeezing out every cycle, it is more about you understanding how a computer works.

      A few simple example (simple usually means that the compiler will correct your misstakes, but I rather not get into to many details):

      unsigned int a; ...
      a = a / 2; // NO NO NO..., this is equivalient to a >> 1 in many cases over 20 times faster

      The next block dels with row major ordering, the code risks running several __thousands__ of times slower than foo[i][j] = bar() due to cache and MMU misses You don't know about these concepts, to bad... you just screwed up your app by not placing the indices right

      for (i = 0 ; i N; i ++ ) {
            for (j = 0 ; i N; j ++ ) {
                  foo[j][i] = bar();
            }
      }

      The same things can be said about Java, Ruby and other high-level langs. Without the fundamentals you can really completely fuck up a system (I have seen enough of that, and I am not that old), by not thinking.

      Just recently, I spent some time to debug a numerical algoritm that I had written. It was crashing occasionally (but not when the debugger was attached). This turned out to be due to rounding effects of floating point numbers. Basically I had something like: acos(f(a)/g(b)), when single stepping through the code I changed the behaviour of the code. This was due to how doubles are handled on x86es. Without the debugger rounding errors and internally 80-bit doubles dictated that I called acos(1.0000000001) (that is of course completely bogus), when the debugger was attached the system constantly flushed the FP-unit and the call was acos(1.0) instead.

      Interesting enough, this app ran on top of the .net CLR (that didn't save me). Would a person who started with Ruby or C# and stayed with high level languages have figured out the error, maybe, but very likely not.

      Here is a nice example from Java and C.

      let farr be a sorted float array of size N

      for (i = 0 ; i N ; i ++) {
            sum += farr[i];
      }

      Now, if N is sufficiently large and farr is sorted in descending order, it is very likely that the sum will be wrong, and that it will be more correct if it is sorted in ascending order.

      Now, you don't get why? Maybe a little understanding of the basics would be a good thing in that case, and then suddenly you feel how useful it was to learn how the computer works in the beginning, and C is an excellent tool to help you with this.

      --
      "Civis Europaeus sum!"
    8. Re:first language by arevos · · Score: 2, Interesting

      As a first programming language, if you are serious about programming, learn C or some Assembler, this will make you understand how a computer actually works and think before you write sucky code. I disagree. It's not necessary to know C or Assembler to program, or even program well (program efficiently, perhaps). It'll teach you about the low level workings of a computer, sure, but not knowing how computers work at a low level is not, I don't think, the reason for 90% or even 95% of all the "sucky code" you'll find.

      As a side note, it is interesting that at the school at which I took my MSc, they used Haskell as a first starting language, basically to tell everyone that "you don't know shit about programming" and bring the sufferers of the perfect programmer syndrome down to the ground. A very good thing indeed. Ouch! Trial by fire! :)
    9. Re:first language by misleb · · Score: 1

      The question remains: What kind of project can one do that would help one learn ASM if one doesn't have embedded systems handy to work with? It is one thing to say "every programmer should be faimilar with assembler," but is that realistic?

      -matthew

      --
      "THERE IS NO JUSTICE, THERE IS ONLY ME." -Death
    10. Re:first language by DragonWriter · · Score: 2, Insightful

      You make a good case that programmers eventually need to learn low-level concepts of how their platform works in order to troubleshoot obscure bugs and optimize performance.

      I'm still not sure why that means you should learn C or Assembler first.

    11. Re:first language by Qzukk · · Score: 1

      Now, you don't get why?

      For those who couldn't figure it out (it took me a few minutes of thought to "get it") the reason why is that precision is limited such that adding (let's do this in base 10 with 4 significant figures) 1.562*10E-5 to 1.328*10E+30 gets you 1.328*10E+30, even if you do the addition 10E50 times. If you start with the little numbers, you'll have added all of the little numbers up by the time you start pushing your significant digits farther and farther from the decimal point. If the answer can't be accurately expressed within that precision, you'll still be "wrong", but at least you'll be right to the extent of your precision/significant digits.

      Incidentally, I started with C64 BASIC ;)

      --
      If I have been able to see further than others, it is because I bought a pair of binoculars.
    12. Re:first language by SecretAsianMan · · Score: 1

      What kind of project can one do that would help one learn ASM if one doesn't have embedded systems handy to work with?

      Answer: Get an embedded system handy to work with. There are hundreds of types of embedded dev kits out there that can get you started. If you need a project, build a security system for your own home, network a coffee maker, or build an autonomous blimp-bot.

      --

      Washington, DC: It's like Hollywood for ugly people.

    13. Re:first language by Anonymous Coward · · Score: 0
      Parent wrote:

      unsigned int a; ...
      a = a / 2; // NO NO NO..., this is equivalient to a >> 1 in many cases over 20 times faster
      Aside from the fact that you forgot to initialize the variable, there's nothing wrong with writing "a / 2". Unfortunately you seem to suffer from the condition known as premature optimization. But don't worry kid, that clears up on its own after about 2 years on the job.

      Repeat after me: Never try to optimize "a / 2" as "a >> 1". Any decent compiler will do this for you if you use the proper optimization level. The reason you should never do it yourself is because it obfuscates the code.

      Ten years ago I thought it was cool to use bit operations to "optimize" my code. Then I left school and entered the real world. Now I can't stand it when young kids come in and screw up the source code with premature optimization. Look for me: I'm that grumpy middle aged guy that will slam you in code review if I ever catch you using bit operations when you should be using arithmetic operations.
    14. Re:first language by lordholm · · Score: 1

      I do agree that that might not have been a very good example. The point here was that even a single change of operators _can_ have drastic consequences.

      Yes, a decent compiler will do that transformation if one use some optimisation level. But... are you aware that in some fields, you are not allowed to enable optimisations on the code?

      Do not take the examples as production quality code, they are there to illustrate low-level behaviour that is easier to grasp if you have a background with C (or other low level language).

      --
      "Civis Europaeus sum!"
    15. Re:first language by Abcd1234 · · Score: 1

      Buy a GBA and a flashcart. About $150 worth of gear, and you have a nice little embedded system with a really nice hardware layout (the ARM has a *wonderful* ISA), plenty of hardware emulators for debugging and so forth (including VBA, which allows you to connect gdb to it and debug an ELF ARM executable directly), and free devkits available.

      Heck, you could just use the emulators, if you're cheap. But it is so much cooler to see "Hello World" pop up on your GBA. :)

    16. Re:first language by Anonymous+Brave+Guy · · Score: 1

      Good code now days has more to do with structure and maintainability as opposed to squeezing every possisble extra CPU out of a procedure.

      You write as if the two are mutually exclusive. IME, while this can be true, it rarely is in practice. The number of people who selectively quote part of Hoare's warning about premature optimisation, and use this as an excuse not to consider efficiency in their programming, is a major contributory factor in the amount of sucky code in the world today.

      Instead of wasting time learning C/assembler, which you probably wouldn't get any use out of, I would go with an OO language such as Java or .net. Stick to the high level languages, no matter what the code programming pursists say.

      Please yourself. In five years' time, when the rest of us are writing concurrent programs in languages that actually support concurrency seriously without introducing race conditions and deadlocks every other function, we "purists" will try not to laugh at you too much for going with popularity rather than understanding and choosing the right tools for the job. :-)

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    17. Re:first language by 1lus10n · · Score: 1

      Java and .net devs are a dime a dozen. Learn Assembler and C, learn howto really performance tune a system and you can clock out hundreds an hour. As long as computers run C and Assembler at some level (and you can bet your ass were a ways away from that changing) people who know those tools will be in demand. So stick with writing your buggy and bloated Java storefronts by all means.

      --
      "Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe." --Albert Einstein
  25. Easiness by Parker+Lewis · · Score: 0

    All new dynamic language claims be more easy to learn than Java. But it's easy from a experienced programmer that ALREADY KNOWS OO. For a totally new programmer, the lack of brackets or ; at the end of the line is not a point of easiness, because the really hard part is learn OO, in Java, Python, Ruby or any other language.

    1. Re:Easiness by crayz · · Score: 1

      Coming from a background of PHP and some C++, I could never "get" OO-programming - it just seemed over-complicated and pointless. With Ruby it started clicking almost instantly. The way that *everything* in Ruby is an object really forces the paradigm on you, and the ease of creating and extending objects really greases the way into using objects and thinking about your program in object-oriented terms

    2. Re:Easiness by John+Nowak · · Score: 1

      Seconded, although for me the language wasn't Ruby, but Io. If you like Ruby's object purity, use Io. It's far more Ruby-like than Ruby in this respect.

  26. Rank this book if you've read it by draed · · Score: 1

    I created this site about 6 months ago for programmers to rank their favorite programming books. The concept is simple, you rank your top 5 favorite books for a particular subject like "Ruby" or "Software Engineering". Specifically here are the top ranked Ruby Books. And here's the list of Top books every programmer should read. Of course, this only really works well if more people rank books, so if you've read this book, rank it(and any other ones you've read).

    1. Re:Rank this book if you've read it by tsdw · · Score: 1

      A very (very very very) good tutorial for Ruby is Why's (Poignant) Guide to Ruby

      It uses humor and short stories to teach and is very effective.

    2. Re:Rank this book if you've read it by Anonymous Coward · · Score: 0

      Add Groovy to your list of languages and I'll start voting (specifically, Groovy In Action).

  27. Try Why the Lucky Stiff's guide by ystar · · Score: 1

    Hmm...I'm not so sure about this book for my Ruby tastes. No cartoon foxes? No thanks!

    1. Re:Try Why the Lucky Stiff's guide by partenon · · Score: 2, Insightful

      +1 on this. Why's Poignant Guide to Ruby is the best tech book I've ever read. I just wish it was available when I was a newb. Why's book is not finished yet, but one can easily learn the basic programming concepts. CHUNKY BACON!! :-)

      --
      ilex paraguariensis for all
    2. Re:Try Why the Lucky Stiff's guide by Stamen · · Score: 1

      This is the one thing that I think is kind of unique to the Ruby community, people like _Why. Also, Yukihiro "Matz" Matsumoto, the creator of Ruby, constantly is in the forums helping out newbs with their questions.

      It's not often mentioned in threads about Ruby, but the community surrounding it is very good and, ultimately, that is very important.

      It's also an awesome language, and although not hugely better than Python (another great language), better none-the-less (mainly for me, because of its fully object oriented-ness, and complete embrace of code blocks and closures).

  28. Re:Ruby as a first language? by DragonWriter · · Score: 1

    I think Ruby would be a great first language. But you may want to also look at Chris Pine's Learn to Program as well as the book reviewed here: what I've heard about it is good, though I haven't looked at it myself.

  29. Re:Ruby as a first language? by mclaincausey · · Score: 1

    the functional support will be good for you if you ever turn to the hardcore languages, like Haskell, C++ and that ilk.
    I think that's the first time I've seen Haskell and C++ lunked in an "ilk" together. I don't think that most new programmers would find much use to the functional piece of Ruby, because you can just as easily write procedural or OO code. Functional programming, at least for me, is something that you have to get used to and that I would never have gravitated towards in a self-guided exploration of programming. Unless you have an understanding of functional programming in the first place (i.e., have studied the Lambda Calculus, a Lisp dialect or Haskell) I think that most newbies programming in Lisp are going to generate (at first undisciplined) code resembling the bastard child of Smalltalk and Algol, using procedural and OO methodologies, not functional ones.

    $0.02

    --
    (%i1) factor(777353);
    (%o1) 777353
  30. Re:Ruby as a first language? by happyfrogcow · · Score: 2, Insightful

    there are editor tools that will do that and more for you, and not just for LISP

    Shh, we need these Lisp jokes every once in a while to keep the Java people in Java, and the Ruby people in Ruby.

    And yes, it's "Lisp" these days not "LISP". Go lurk at comp.lang.lisp if you don't believe me.

  31. Re:I would rather have.... by jlawson382 · · Score: 1

    So, would you say you were tired of this MF'ing ruby on these MF'ing rails?

  32. Re:Ruby as a first language? by eneville · · Score: 1

    ... I guess it's kind of like the school of hard knocks for programmers. ... Hehe, that's quite funny. I have gone through a bunch of languages and perl is the one that I keep coming back to. It might be because I generally have a lot of sysadmin tasks to perform, which is where it's very suited. I have yet to do any huge website projects with perl, but I imagine that JSP or PHP will take preference when I have to do that next.
  33. Beware of the hype around Ruby by Anonymous Coward · · Score: 1, Insightful

    I am a seasoned developer and one of my client pushed very hard for ruby/rails.

    This is a scripting language, and you really feel the difference with a more generic language.

    Ruby spirit is "wild" :

    you will have tons of libs that gonna patch standard classes everywhere (patch, like in patch, not extend)

    it ends up with conflicting changes !! one require of the wrong lib and rails is crashing everywhere and it is very difficult to diagnose

    duck typing renders code very hard to follow because sometime your ducks looks like ducks aren't really, you will know it late at the execution or in obscure cases

    thread works cooperatively, forget about integrating nicely native code

    Documentation is sparse or inexistent on lots of libs [comparing it to the apache libs for example]

    No coding convention is really followed

    No strict language spec : I find it really important because even with one it is often hard to standardize a language !

    No type, no help -> for everything you have to jump into a paper doc or an API search just to see what this function is taking as parameter forget about the productivity of your ctrl-space in Eclipse

    I18N is non existent and iconv horrible to use.

    etc... I could go on but I think you get the point ... In short, I feel it well behind Java or C# in a professional point of view

    I really went into ruby open minded and I am really disapointed : really, you try Ruby/Rails and it is a instant "WOW!" relayed by every journalist who just tried it ... My only advice is to let this "wow" period settle down before making a hard decision to switch.

    Guillaume.

    1. Re:Beware of the hype around Ruby by Anonymous Coward · · Score: 0

      Really, well watch what I can do in Ruby that I cant do in C#

      Names.split(", ").each{|user_name| puts user_name}

      Hmmm.... one line of code to parse a string of comma seperated values and print them down the screen, and look at that, I can read it and know what its doing. Is this hype or common sense?

  34. Re:Ruby as a first language? by donglekey · · Score: 1

    I would start with Lua, Maybe. Then again, I just might not have enough experience with it to know where it falls short. (Anyone have the answer?). The reason being, is that it is very very simple and that is pretty much it. Not a whole bunch of crap. Then again I started with Javascript and Visual Basic, and those are both great places to begin. Comfortable development environments. With javascript, you can make an HTML form and a button that calls the function, and play around with the language. Very easy, and all you need is firefox. The info is all over the web (but web source is. The real point is, start simple. Many constructs in modern languages are there because of 60,000 line programs, not 100 line programs, and you don't need that getting in your way yet.

  35. Re:Ruby as a first language? by DragonWriter · · Score: 1

    Unless you have an understanding of functional programming in the first place (i.e., have studied the Lambda Calculus, a Lisp dialect or Haskell) I think that most newbies programming in Lisp are going to generate (at first undisciplined) code resembling the bastard child of Smalltalk and Algol, using procedural and OO methodologies, not functional ones.


    I don't think that's all that true. I think it easy for people who themselves came to program through imperative and OO programming to think of those approaches as more "natural" than functional programming. But if someone's first exposure to programming includes functional programming from the outset, I don't think functional programming is any less natural than the other forms.

    And I have a feeling a newbie programmer who learns Ruby first is going to end up and using constructs that combine OO and functional elements (passing closures to method calls on integer literals, for instance) rather than imperative mechanisms for basic tasks like looping, because, I can't imagine an newbie-focussed book not encouraging that. Sure, I mean, you could stubbornly try to do everything with while loops, but why?

  36. Ruby on Rails before PHP or bare JSP by Ayanami+Rei · · Score: 1

    PLEASE

    Let's use MVC for our large sites for fuck's sake.

    Thanks.

    --
    THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
  37. Why so down on perl? by Ayanami+Rei · · Score: 1

    Because sometimes Ruby is too slow. :-(
    Both Perl and Ruby are really rad. And RAD. And they both operate on the ever-so-helpful principle of least surprise. Unlike PHP, or a lot of other languages. :-/

    If there was one thing I don't like about perl (and I can totally sympathize from a language beauty POV), it's that sigils represent interpretation intent, and do not describe the base object.

    I.E.
    $foo[bar] is a value in @foo not @foo[bar]. Which seems silly because the array slicing operator has list and value return forms ([5], vs. [3..5]) and that should dictate the interpretation. Other perl ops get to dictate return values... why the distinction?
    And it's because Perl 5 is backwards compatible with Perl 4 which didn't have lexical namespaces, and so the sigils got ALL FUCKED UP during the transition and it makes Perl 5 look ugly. :-(

    --
    THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
    1. Re:Why so down on perl? by chromatic · · Score: 1

      And it's because Perl 5 is backwards compatible with Perl 4 which didn't have lexical namespaces...

      It has nothing to do with that. It would have been perfectly possible to have invariant sigils with the typeglob system.

    2. Re:Why so down on perl? by Ayanami+Rei · · Score: 1

      No. I mean that changing the meaning of Perl 5 sigils to be lexical would break existing Perl 4 scripts, and so this was not done.
      Perl 6 intends to do that, but Perl 6 seems a foregone conclusion now.

      --
      THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
    3. Re:Why so down on perl? by chromatic · · Score: 1

      By "lexical" do you mean "invariant"? If so, then you're right, Larry kept them variant (now there's a phrase twisting out of control) to retain backwards compatibility with everything back to Perl 1, sort of. Perl 1 had a couple of odd rules for sigil variance related to hashes, I believe.

      ... and doubt Perl 6 all you want, but I just fixed a bug in Parrot a few minutes ago.

    4. Re:Why so down on perl? by Anonymous Coward · · Score: 0

      A foregone conclusion means that something is considered inevitable. But you're using it, if I follow your drift, to mean "not gonna happen."

  38. C# is interesting. by Ayanami+Rei · · Score: 1

    But Microsoft and 3rd party contributors to .NET will always skew the ecosystem around it to its own ends, even if it is an open standard. No one will care about ECMA-compliance, only the latest-version-of-.NET-on-the-latest-Windows-serve r compliance.

    --
    THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
  39. Re:Ruby as a first language? by e4g4 · · Score: 1

    Perl is great for sysadmin scripts (actually, though, so is Ruby) - what it's not great for is huge website projects (unless your a masochist - slashcode, i'm looking at you). The problem with Perl and PHP for large web projects is that even with decent project management, one bad programmer can make problems for the whole team a few months down the line after deployment. The thing I like about rails is that it forces the developer into good code-separation practices, which is a very Good Thing when you've got developers on your team with little formal training.

    --
    The secret to creativity is knowing how to hide your sources. - Albert Einstein
  40. This only proves two things. by Estanislao+Mart�nez · · Score: 1
    1. You are good at making up contrived examples that people will either (a) face infrequently, or (b) face only if they work on some particular problem area, but are irrelevant in others.
    2. You either work in a problem area where you've had to learn these tricks of the trade because you keep running into them, or you're one of those damnable creatures: the premature optimizer.
  41. Books for a language? Why? by thePowerOfGrayskull · · Score: 1
    I used to buy these books -- Ruby, PHP, Java, etc. But I realized a startling thing -- I never used them after I read the first couple of chapters. Because those first couple of chapters inevitably showed me that it was just another programming language. It was either OO or proedural, but outside of that no significant differences.

    So why waste 40-60USD on a book that provides information that is freely available on the Internet? Is it really something that looking at free documentation and examples won't teach a reasonably intelligent programmer?

    1. Re:Books for a language? Why? by Anonymous Coward · · Score: 0

      I use my favorite Perl book, Perl Best Practices by Conway, almost every day I write perl. Why? Because I can't remember all the useful tricks and hacks that make writing Perl fun and easy. Same reasoning goes for the O'Reilly Cookbook series. Yeah, you can find plenty of good examples online, but having a single book with 80% of the example you'll ever need is a much better thing.

    2. Re:Books for a language? Why? by magus_melchior · · Score: 1

      To add to parent's point, it's often quicker and easier to turn your head at an open book rather than switch tabs or windows.

      Oh, I know, you can print out the stuff on the web, but those of us who are lazy tend to lose the printouts in an amorphous pile of paper.

      --
      "We are Microsoft. You shall be assimilated. Competition is futile."
    3. Re:Books for a language? Why? by LizardKing · · Score: 1

      Try Haskell - I've been trying to learn it for several weeks now, but coming from a C background I'm really struggling. That's not necessarily a criticism of Haskell, more a sign of how different functional programming is to procedural programming.

  42. Re:Ruby as a first language? by Ankur+Dave · · Score: 1

    I agree with you that Perl is hard to maintain for websites of any reasonable size. But I still use Perl for websites because of how intuitive I find coding in it. (And Perl wasn't even my first language...)

  43. Re:Ruby as a first language? by e4g4 · · Score: 1

    Heh. Don't get me wrong, I love perl; particularly because of how intuitive it is (at least for me). What I find to be perl's biggest flaw is that while, yes, it is intuitive to many people the perl that I write is almost a different language from the perl that everybody else writes - which helps make it an intuitive language, but at the same time makes it hard as hell to read somebody else's perl code; which, in a production environment is simple unacceptable.

    --
    The secret to creativity is knowing how to hide your sources. - Albert Einstein
  44. Ruby on Blue Gene/L by GrEp · · Score: 1

    Ruby now runs on Blue Gene/L :)
    http://www.ece.iastate.edu/~crb002/cnr.html

    --

    bash-2.04$
    bash-2.04$yes "Don't you hate dialup connections?"| write USERNAME
  45. Re:Ruby as a first language? by chromatic · · Score: 1

    Let me fix this sentence for you:

    The problem with ... large ... projects is that even with decent project management, one bad programmer can make problems for the whole team....

    The thing I like about rails is that it forces the developer into good code-separation practices...

    Wow. Sorry, I can't fix that one.

  46. Re:Ruby as a first language? by chromatic · · Score: 1

    ... the perl that I write is almost a different language from the perl that everybody else writes - which helps make it an intuitive language, but at the same time makes it hard as hell to read somebody else's perl code; which, in a production environment is simple unacceptable.

    Why are you not following your team's coding standards?

  47. Re:Ruby as a first language? by EsbenMoseHansen · · Score: 1

    I think that's the first time I've seen Haskell and C++ lunked in an "ilk" together.

    They are really not that dissimilar, though the syntax are :) (Meta)-programming with templates in C++ and doing Haskell is remarkedly similar, though the syntax is not --- if you don't believe me, have a look at the boost::lambda source. Anyway, above I just meant that they are both advanced languages, as in powerful and difficult to master.

    As to the rest of your comment, I think passing closures around will come naturally to most newbies of taught. The hard part of functional languages, using the lambda calculus to it's fullest extent, is not support in Ruby anyway.

    --
    Religion is regarded by the common people as true, by the wise as false, and by rulers as useful.
  48. This looks like a pretty cool use of ruby... by simongoldstein2002 · · Score: 1

    been following this development for a bit...huge agile fan if it matters.... http://studios.thoughtworks.com/mingle-project-int elligence/a-quick-tour

  49. High level languages vs. assembly by Anonymous+Brave+Guy · · Score: 1

    The rules of the game have changed in two important ways over the intervening years, though:

    1. Writing efficient assembly language by hand got harder. With the move to the mainstream of pipelining and caching technologies, you can't just write assembly instructions in any old order to get the fastest results any more. And of course, we have many extra instructions available on modern chips: the Intel/AMD family alone now have something like seven or eight supplementary instruction sets for specialist numerical applications, on top of the basic IA-32 stuff that remains the lingua franca of PC assembly coding. Manually generating optimal assembly code is therefore much more difficult than it used to be, and very much a specialist activity. (Those specialists are typically employed writing optimising compilers.)
    2. Optimiser technology got better. Up until a few years ago, even the most powerful optimisations in separate compilation languages like C and C++ were pretty much local to a particular file. Today, improved compiler/linker technology allows for global optimisations. Optimisation based on real world profiling data is possible. And of course, the basic underlying optimisations are more varied and more powerful; note the adoption of SSA within GCC, for example.

    This isn't to say that hand-crafted assembly language no longer has a place. C and C++ are pretty low-level languages, and don't convey a lot of semantic information that the programmer has. Thus the compiler and optimiser are constrained in the assumptions they can safely make, with aliasing being the classic example problem. Even when they do "understand", their generic code generators may not give 100% optimal assembly in every single case. I work in high performance numerics, and I've seen my share of little functions that surprisingly weren't inlined (until, knowing that they aren't and thinking about it more deeply, you realise what assumption couldn't be made by the compiler and it's not surprising any more). I've certainly seen needlessly slow assembly language emitted in critical functions.

    But the rules have changed, and the market for lovingly hand-crafted assembly is much smaller than it used to be. Software development is, in practice, all about "good enough". With today's rules, compilers are good enough a lot more often than they used to be. In contrast, writing better enough assembly language by hand is an increasingly difficult job, and the time spent doing so might well be better spend optimising some algorithm or data structure at a higher level, or filing a performance bug with your compiler vendor so they can fix their assembly language generation more generally.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    1. Re:High level languages vs. assembly by tyler.willard · · Score: 1

      Absolutely.

      Thanks for pointing those things out :)

      Personally, about the only call I've had to hand code assembly in the last 5 years wasn't for speed, but rather to do some hinky things that the compiler wouldn't/couldn't do (basically, linking at runtime).

  50. Re:Ruby as a first language? by grumbel · · Score: 1

    ### Ruby is not terribly lisp like in any way.

    Ruby is very much like Lisp in many aspects, of course not in all, especially not syntax, but that is actually the good thing about Ruby. It gives you almost all the power of Lisp, but with a syntax that is much easier to read. I mean macros in Lisp are cool, but the blocks in Ruby are just way more readable and more practical, not as powerful, but powerful enough.

  51. Ruby, Ruby, Ruby... by Anonymous Coward · · Score: 0
  52. Re:Ruby as a first language? by iggymanz · · Score: 1

    nah, I'm an old fart LISPer, haven't written any for 13 years. Ruby is more fun if very slightly less powerful. I've decided I like languages that are built to get shit done rather than tickle ivory tower fancies.