Or to extend the analogy, be like the art students I always saw in
museums. Whenever I got the opportunity to roam the halls of the
Louvre or the Prado, I inevitably saw students with easels, not just
looking at the works, but trying to learn from them by
"reimplementing" them in their own way.
···
On Sun, Mar 30, 2008 at 11:01 AM, Dave Thomas <dave@pragprog.com> wrote:
On Mar 30, 2008, at 9:48 AM, Tuan Minh wrote:
> But you praise it as beauty, art language..etc, however, why don't you
> give some examples to prove those opinion.
Perhaps the onus is now on you to try it and experience these things
for yourself.
Programming is not art in the same way that painting is--you don't
wander down a hall and look at things on the wall. Programming is art
in the sense of craft--you come to appreciate it through doing it.
Ruby's biggest strength is that it is such a good set of designs that many of the best people have come to try and work with it, and that makes it better again. If you look at any code in Ruby, it tends to be relatively well designed and clean if it's in the public sphere. Contrast that to, and I have to admit this is my favorite example, the code for Perl's LWP. Sorry perl programmers, but I used to be a Perl programmer, and I had to dig through that thing. Look then at the code for similar tools in Ruby, and they are better designed, easier to read, and generally more helpful.
That being said, Perl, Smalltalk, Python are very important ancestors to Ruby, and I particularly respect them all for what they were in their time.
xc
···
--
There is more safety in diversity; more danger in great power.
There is love in effort to understand; hatred in refusal to.
Even if you spell all the ruby out fully, then you end up with less code, and it's much nicer looking and easier to understand, even to non-programmers:
range = (1..100)
multiplied_numbers = range.map{|num| num * 300}
string_to_output = multiplied_numbers.join(" ")
puts string_to_output
It's a trite example, and I agree that both your implementations are ugly. With any language, the unfamiliar will tend to write clumsy code that obscures their intention. I get the impression you're not interested in being persuaded, but:
1.upto(100) do | i |
printf "%d ", i * 300
end
>> But even if you think the syntax is
clean, ruby is all about cramming 4 or 5 function calls into one line
and sprinkling some regex's in for spice, which is creates an
indecipherable mess.
You're missing the point that iterators - one of the commonest tasks - are easier, clearer and terser to write in Ruby than your C-esque for(...) loop or even a Perl "foreach @array" or "each %hash".
The fact that some people choose to use all the space which they saved in not writing tedious loop verbiage to cram multiple method calls into a line is a matter for their taste, or lack of it. I think you'd be hard-pushed to find examples in, for example, the ruby standard libraries.
Do you really want to collect all the numbers into a sequence and then
join with a separator into a string just to print the string and
discard? Consider your solution when using very large N.
···
On Mar 27, 8:36 pm, Julian Leviston <jul...@coretech.net.au> wrote:
One thing that was hard for me to grasp at first, but now love, is
that Ruby sort of gives you a sense of thinking of an object as a
living thing with it's own personality, including syntax, or "birth"
of the object, if you will. It makes it easy to do the "my object can
interact with yours as long as we can handshake" OO.
Now, for maintenance, I've found that unless the code is intentionally
obfuscated, it's not that hard to go over it regardless of style. Of
course, it's nice to have conventions to keep everyone working on a
project mildly in check.
Todd
···
On Sat, Mar 29, 2008 at 1:40 AM, Christopher Dicely <cmdicely@gmail.com> wrote:
Ruby can be hard to decipher coming from many other popular languages,
as many use
very similar (to each other) C-like syntax, and Ruby is both different
in important ways and
freer (optional parens, for instance) than most C-like languages. This
isn't an issue of hygiene
("clean" code) so much as it is one of familiar syntax. TMTOWTDI also
means that different
programmer's will express things in the ways most natural to them,
which may not be the
most natural to other readers.
On Sun, Mar 30, 2008 at 11:01 AM, Dave Thomas <dave@pragprog.com> wrote:
On Mar 30, 2008, at 9:48 AM, Tuan Minh wrote:
> But you praise it as beauty, art language..etc, however, why don't you
> give some examples to prove those opinion.
Perhaps the onus is now on you to try it and experience these things
for yourself.
Programming is not art in the same way that painting is--you don't
wander down a hall and look at things on the wall. Programming is art
in the sense of craft--you come to appreciate it through doing it.
Or to extend the analogy, be like the art students I always saw in
museums. Whenever I got the opportunity to roam the halls of the
Louvre or the Prado, I inevitably saw students with easels, not just
looking at the works, but trying to learn from them by
"reimplementing" them in their own way.
Be careful, though, or you'll get accused of "re-inventing the wheel" I've always thought that it's fine, and often fun, to write
programs that do what others already do. I think of it as more like
being a wheelwright than a re-inventor of the wheel.
David
--
Rails training from David A. Black and Ruby Power and Light:
ADVANCING WITH RAILS April 14-17 New York City
INTRO TO RAILS June 9-12 Berlin
ADVANCING WITH RAILS June 16-19 Berlin
See http://www.rubypal.com for details and updates!
They let you bring an easel and paint into the Louvre and just start
painting? Cool.
···
On Mar 30, 11:23 am, Rick DeNatale <rick.denat...@gmail.com> wrote:
...
Or to extend the analogy, be like the art students I always saw in
museums. Whenever I got the opportunity to roam the halls of the
Louvre or the Prado, I inevitably saw students with easels, not just
looking at the works, but trying to learn from them by
"reimplementing" them in their own way.
You're missing the point that iterators - one of the commonest tasks -
are easier, clearer and terser to write in Ruby than your C-esque
for(...) loop or even a Perl "foreach @array" or "each %hash".
De gustibus non disputandum est.
The reordering of the words is just reflecting my taste, that's what's
cool in Latin, you can use prefix or sufffix method calls.
"One can not argue about matters of taste" I prefer however "It is
futile to argue about matters of taste" but I always got bad marks in
Latin.
I believe it is not a quote but a proverb ( which might come from a
quote of course), but well I have no idea, I claim only half of the
point.
Cheers
Robert
···
On Sat, Mar 29, 2008 at 6:34 PM, s.ross <cwdinfo@gmail.com> wrote:
On Mar 28, 2008, at 11:40 PM, Christopher Dicely wrote:
So, you think this: #include <stdio.h>
for(count = 1; count <= 200; count++) {
printf("%d ", count * 300);
}
is less ugly than this:
puts (1..100).map{|num| num * 300}.join(" ")
are you serious?
Even if you spell all the ruby out fully, then you end up with less code, and it's much nicer looking and easier to understand, even to non-programmers:
range = (1..100)
multiplied_numbers = range.map{|num| num * 300}
string_to_output = multiplied_numbers.join(" ")
puts string_to_output
It's a trite example, and I agree that both your implementations are ugly. With any language, the unfamiliar will tend to write clumsy code that obscures their intention. I get the impression you're not interested in being persuaded, but:
1.upto(100) do | i |
printf "%d ", i * 300
end
>> But even if you think the syntax is
clean, ruby is all about cramming 4 or 5 function calls into one line
and sprinkling some regex's in for spice, which is creates an
indecipherable mess.
You're missing the point that iterators - one of the commonest tasks - are easier, clearer and terser to write in Ruby than your C-esque for(...) loop or even a Perl "foreach @array" or "each %hash".
The fact that some people choose to use all the space which they saved in not writing tedious loop verbiage to cram multiple method calls into a line is a matter for their taste, or lack of it. I think you'd be hard-pushed to find examples in, for example, the ruby standard libraries.
The more idiomatic English translation would be something like,
"There's no accounting for taste!"
As for the source, I'm pretty sure that the identity of whoever first
uttered it is obscured by the sands of time.
···
On Sun, Mar 30, 2008 at 10:21 AM, Robert Dober <robert.dober@gmail.com> wrote:
On Sat, Mar 29, 2008 at 6:34 PM, s.ross <cwdinfo@gmail.com> wrote:
> On Mar 28, 2008, at 11:40 PM, Christopher Dicely wrote:
> > Degustibus non est disputandum.
>
> Extra points for translation and source of quote
De gustibus non disputandum est.
The reordering of the words is just reflecting my taste, that's what's
cool in Latin, you can use prefix or sufffix method calls.
"One can not argue about matters of taste" I prefer however "It is
futile to argue about matters of taste" but I always got bad marks in
Latin.
I'm making a essay about Ruby on Rails.
You can give me some advices how to do it better.
I wrote some topics in Rails but it don't long enough(~50 pages Doc) and
my teacher require essay don't concern about code much.
I wrote about history, MVC, Ruby, Relatation Database,Active
Record,Action Pack... Now, what should I write more?
Thanks
What about Server/Client, request/response, TCP/IP, the web, etc.? REST? They're the backbones it sits on.
Julian
Learn Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME) NEW VIDEO OUT 3rd APRIL http://sensei.zenunit.com/
···
On 02/04/2008, at 3:35 PM, Tuan Minh wrote:
I'm making a essay about Ruby on Rails.
You can give me some advices how to do it better.
I wrote some topics in Rails but it don't long enough(~50 pages Doc) and
my teacher require essay don't concern about code much.
I wrote about history, MVC, Ruby, Relatation Database,Active
Record,Action Pack... Now, what should I write more?
Thanks
--
Posted via http://www.ruby-forum.com/\.