From: "M. Edward (Ed) Borasky" Date: 2006-06-11T10:47:18+09:00 Subject: Re: Fun Coding Elliot Temple wrote: > ultimately, any technique with unnecessary repetition can get > frustrating when you know better ways to accomplish the same task. > > ruby does a good job of helping us avoid repetition. it's always > possible in other languages (at least if you count code generators). > but in ruby it's often convenient. and if you're being paid to do > something, you have to do it reasonably fast, so you can't write a > code generator to avoid a little copy/pasting. > > also, a lot of us aren't perfect. so we'd like to avoid repetition, > but don't always know how to, or notice the repetition. ruby helps us > notice it, and avoid it. sometimes ruby helps us avoid it without even > noticing anything has happened. this could increase the subjective fun > factor of ruby, because we find ourselves writing better, DRYer code. *Somebody* has to do the tedious jobs. Our preference as programmers is to automate them, of course. I'd like to semi-challenge a couple of your frames, though: 1. "If you're being paid to do something, you have to do it reasonably fast." Sure, we have to meet deadlines, but if you can't ask for more time to get correct results, I don't care what language you're using ... fun just disappeared by definition. 2. You can usually write a code generator very quickly in almost any language. Regular expressions make it easier; so do compiler-compilers if you know how to use them. > similarly, by being higher level than some languages, ruby sometimes > helps us to write complex, interesting algorithms. I think most of today's languages allow recursion, iteration, control flow, and some form of object-oriented design, although the details of the object paradigms are widely different in Ruby and, say, R or CLOS. What I see as Ruby's main advantages are 1. Scripting language features: interpreted, dynamic typing 2. "Conventional" object design paradigms: classes, methods, message-passing 3. Built-in data structuring and regular expression handling. Perl has 1 and 3 but falls short on 2. Objects were tacked on to Perl and it shows. Java has 2 and 3 but falls short on 1. R has a little of 1, an unconventional but highly useful (for its domain) set of object paradigms, and some of 3. C has none of these and C++ only has 2. > ruby is prettier and less verbose than some languages. hitting extra > keys on the keyboard is a form of needless work/repetition. pretty and > elegant code seems fun to me. There are different kinds of elegance. I find elegance in Forth's threaded inner interpreter, Lisp's macros, selectors, constructors and predicates, APL's array orientation, Perl's arrays and hashes, and *everybody's* garbage collection. And, of course, given how long I've been programming, I find immense joy in the simple fact that I now have both upper and lower case letters at my disposal. :) > > if we can still read our code a month later, maybe that's fun. if we > can read our code to our girlfriend because it's so much like English, > maybe that's fun. OK ... again it seems that the programming practices and styles are what makes programming fun or not fun, not the language. -- M. Edward (Ed) Borasky http://linuxcapacityplanning.com