[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

"Succinctness is Power", by Paul Graham

Rich Morin

9/28/2006 5:27:00 PM

This is probably old news to many here, but I found it
to be an interesting read, with implications for Ruby.

"Succinctness is Power"
Paul Graham

-r
--
http://www.cf... Rich Morin
http://www.cf.../resume rdm@cfcl.com
http://www.cf.../weblog +1 650-873-7841

Technical editing and writing, programming, and web development

44 Answers

M. Edward (Ed) Borasky

9/30/2006 4:29:00 AM

0

Rich Morin wrote:
> This is probably old news to many here, but I found it
> to be an interesting read, with implications for Ruby.
>
> "Succinctness is Power"
> Paul Graham
>
> -r
I'm totally underwhelmed by Paul Graham's writings. First of all,
succinctness in programming languages gives rise to languages like
Forth, Scheme/Lisp, and APL. While all three have their cults, and all
three are still in use in their well-defined niches, they are not viable
candidates for most programming projects for one reason or another.

Second, the "conventional wisdom" is that the power of Ruby comes from
dynamic typing, flexible syntax, metaprogramming, and a kind of "upward
compatibility" from Perl.I don't think succinctness is a factor.

greg.kujawa

9/30/2006 4:37:00 AM

0

Agreed. The only way that I consider Ruby as being more succinct
compared to other languages such as C++, C, Java, VB, etc. is that
there's less curly braces, and no redundant typing of new static
variables. God, I'm glad I can choose what I program in!

If I was to make a string in Java I would say:

String myString = new String("foo");

But if I was in Ruby I would just say:

myString = "foo"

I know it's not like I'm typing the Rosetta Stone, but Ruby saves me a
lot of needless typing (bad pun intended perhaps).


M. Edward (Ed) Borasky wrote:
> Rich Morin wrote:
> > This is probably old news to many here, but I found it
> > to be an interesting read, with implications for Ruby.
> >
> > "Succinctness is Power"
> > Paul Graham
> >
> > -r
> I'm totally underwhelmed by Paul Graham's writings. First of all,
> succinctness in programming languages gives rise to languages like
> Forth, Scheme/Lisp, and APL. While all three have their cults, and all
> three are still in use in their well-defined niches, they are not viable
> candidates for most programming projects for one reason or another.
>
> Second, the "conventional wisdom" is that the power of Ruby comes from
> dynamic typing, flexible syntax, metaprogramming, and a kind of "upward
> compatibility" from Perl.I don't think succinctness is a factor.

Charles O Nutter

9/30/2006 6:02:00 AM

0

On 9/29/06, gregarican <greg.kujawa@gmail.com> wrote:
> If I was to make a string in Java I would say:
>
> String myString = new String("foo");

No, you would say

String myString = "foo";

Java does have literal strings, you know.

--
Contribute to RubySpec! @ www.headius.com/rubyspec
Charles Oliver Nutter @ headius.blogspot.com
Ruby User @ ruby.mn

Rick DeNatale

9/30/2006 2:06:00 PM

0

On 9/30/06, gregarican <greg.kujawa@gmail.com> wrote:

> If I was to make a string in Java I would say:
>
> String myString = new String("foo");
>
> But if I was in Ruby I would just say:
>
> myString = "foo"
>
> I know it's not like I'm typing the Rosetta Stone, but Ruby saves me a
> lot of needless typing (bad pun intended perhaps).

In the old days we used to day "Strong typing breaks keyboards!"

--
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denh...

David Vallner

9/30/2006 3:59:00 PM

0

gregarican wrote:
> I know it's not like I'm typing the Rosetta Stone, but Ruby saves me a
> lot of needless typing (bad pun intended perhaps).
>

Funnily enough, I find full autocomplete saves me more net keystrokes.
And reaching for the Shift key. And I find keystroke arguments silly
overall.

However, type inferencing local variables I'd still stab for.

David Vallner

Pete Yandell

9/30/2006 5:14:00 PM

0


On 30/09/2006, at 2:40 PM, gregarican wrote:

> Agreed. The only way that I consider Ruby as being more succinct
> compared to other languages such as C++, C, Java, VB, etc. is that
> there's less curly braces, and no redundant typing of new static
> variables. God, I'm glad I can choose what I program in!

While I don't think Paul Graham's idea of succinctness is the only
measure of the value of a programming language, I think he's on to
something. Succinctness can give you an idea of the level at which
concepts can be expressed in a language.

By way of example, here's some code from one of my production Ruby
apps that takes an array of different versions of a Monkey object
(don't ask), and returns a new array containing the changes between
each version and the next:

monkeys.enum_cons(2).collect {|a, b| b.differences_from(a) }

This is a lot more succinct than any way I can think to write the
equivalent in C++, C, Java, VB, etc. precisely because Ruby has
constructs that let me express the ideas of "step through pairs of
elements in this array" and "collect the results of applying an
operation to each one". In most languages, of course, I'd have to
write my own loop and do this step by step.

This is powerful because I'm expressing things in the same way I
naturally think about the problem: step through the array in pairs,
collecting the results of taking the differences between each pair.
That means fewer errors, simpler testing, more confidence in the
code, and better readability and maintainability.

So we have some good succinct code. Is the succinctness what's good
about it? Not in itself, but the succinctness certainly hints that we
must be describing our solution at a fairly high level, and that's a
good thing.

Pete Yandell


Giles Bowkett

9/30/2006 7:23:00 PM

0

I think he's onto something but that there's more to the picture.
Actually what I found more interesting was one of the links off the
essay, though, specifically this one:

http://wwwipd.ira.uka.de/~prechelt/Biblio/jcc...

In which a study of the same problem solved by many different
programmers in many different languages found that there were definite
productivity differences between languages, but that the productivity
differences between programmers were much more significant.

I think it's obvious that succinctness is a particular power, but the
question of succinctness being equivalent to power, I'm still somewhat
unconvinced.


--
Giles Bowkett
http://www.gilesg...


On 9/30/06, Pete Yandell <pete@notahat.com> wrote:
>
> On 30/09/2006, at 2:40 PM, gregarican wrote:
>
> > Agreed. The only way that I consider Ruby as being more succinct
> > compared to other languages such as C++, C, Java, VB, etc. is that
> > there's less curly braces, and no redundant typing of new static
> > variables. God, I'm glad I can choose what I program in!
>
> While I don't think Paul Graham's idea of succinctness is the only
> measure of the value of a programming language, I think he's on to
> something. Succinctness can give you an idea of the level at which
> concepts can be expressed in a language.
>
> By way of example, here's some code from one of my production Ruby
> apps that takes an array of different versions of a Monkey object
> (don't ask), and returns a new array containing the changes between
> each version and the next:
>
> monkeys.enum_cons(2).collect {|a, b| b.differences_from(a) }
>
> This is a lot more succinct than any way I can think to write the
> equivalent in C++, C, Java, VB, etc. precisely because Ruby has
> constructs that let me express the ideas of "step through pairs of
> elements in this array" and "collect the results of applying an
> operation to each one". In most languages, of course, I'd have to
> write my own loop and do this step by step.
>
> This is powerful because I'm expressing things in the same way I
> naturally think about the problem: step through the array in pairs,
> collecting the results of taking the differences between each pair.
> That means fewer errors, simpler testing, more confidence in the
> code, and better readability and maintainability.
>
> So we have some good succinct code. Is the succinctness what's good
> about it? Not in itself, but the succinctness certainly hints that we
> must be describing our solution at a fairly high level, and that's a
> good thing.
>
> Pete Yandell
>
>
>

Dr Nic

10/1/2006 5:53:00 AM

0

Giles Bowkett wrote:
> I think it's obvious that succinctness is a particular power, but the
> question of succinctness being equivalent to power, I'm still somewhat
> unconvinced.

Perhaps he's inferring a non-equivalence relationship, but perhaps a "is
propotional to" relationship, or similar based on how you go about
measuring succinctness and power in the first place.

Nic

--
Posted via http://www.ruby-....

M. Edward (Ed) Borasky

10/1/2006 7:23:00 AM

0

Dr Nic wrote:
> Giles Bowkett wrote:
>> I think it's obvious that succinctness is a particular power, but the
>> question of succinctness being equivalent to power, I'm still somewhat
>> unconvinced.
>
> Perhaps he's inferring a non-equivalence relationship, but perhaps a "is
> propotional to" relationship, or similar based on how you go about
> measuring succinctness and power in the first place.
>
> Nic

Well, considering that Paul Graham is a Lispnik, I think we can infer
what his definitions of "powerful" and "succinct" in a programming
language are. What would be interesting to me would be where he stands
on the great "Common Lisp vs. Scheme" divide. Or what he thinks of
Forth, the "other succinct and powerful language." :)

Perhaps more to the point would be a comparison of Lisp, Scheme and Ruby
as hosts for internal domain-specific languages. Didn't somebody do that
already?


Martin Coxall

10/1/2006 10:13:00 AM

0

>
> Well, considering that Paul Graham is a Lispnik, I think we can infer
> what his definitions of "powerful" and "succinct" in a programming
> language are. What would be interesting to me would be where he stands
> on the great "Common Lisp vs. Scheme" divide.

He's definitely from the Schemer tradition; Favouring recursion over
iteration even though Common Lisp is not tail-recursive; Eschewing
Common Lisp's powerfool 'Loop' construct because it's not lispish
enough; Frequently explaining how using OO, and in especial, CLOS,
are simply artifacts of not knowing how to use macros and lambdas
properly; Listing a feature set for that 'dream lisp' you're going to
create one day which has almost a one-to-one feature parity with
Scheme R6RS.


> Perhaps more to the point would be a comparison of Lisp, Scheme and
> Ruby
> as hosts for internal domain-specific languages. Didn't somebody do
> that
> already?
>

Down that way lies flamewars, madness and death. I reckon it is
sufficient to notice that Scheme is a little too minimalist to be a
useful general-purpose language, the relative paucity of Lisp's
library ecosystem works against its chances of ever breaking the
mainstream and that Matz admits himself to borrowing good things
liberally from Lisp(s) just as from Smalltalk and Perl, Ruby's two
other formidable forbears.

In any case, there's a question about about to what extent you
*should* host DSLs internally. It's my feeling that if you want to
inline a DSL in your code, make sure that language is still
syntactically recognizably a Ruby. Ruby on Rails is a classic example.

If you want to create a non-idiomatic, syntactically strange DSL and
inline it in your code via abuse of language facilities, that's how
you end up with Common Lisp's 'Loop' Macro. It's not good, and it's
definitely ugly, as Paul Graham says.

Once you cross that line where your DSL is no longer 'a Ruby', create
a grammar for it and knock together a parser for it in Racc.

Martin