why dosn't ruby support // to comment?

F

Francis Hwang

This is pretty pedantic, but maybe comments should be really difficult
to type. Something like "#JjI1e9()**" Then it won't be much more work
to just extract out a smaller method, and use the new method name to
document your code. ;)

i think use keyboard type "//" is fast than "#" to comment one line
code.

:)

_______________________________________________
programming is my life
my blog:http://blog.itpub.net/liubin
http://www.ruby-cn.org/

Francis Hwang
http://fhwang.net/
 
T

Tim Hunter

Francis said:
This is pretty pedantic, but maybe comments should be really difficult
to type. Something like "#JjI1e9()**" Then it won't be much more work
to just extract out a smaller method, and use the new method name to
document your code. ;)
Actually I'm surprised that this thread has generated so much interest. In
an effort to improve my Ruby skills, I've been reading the sources to some
well-known Ruby applications and libraries to see how good Ruby programmers
write code. (I won't name them but you-know-who-you-are.) One thing that
stands out is a noticeable lack of anything resembling a comment.

Just reading these sources you'd think that # already is as hard to type as
#Jjl1e9()**. :)
 
A

Alexey Verkhovsky

Tim said:
One thing that
stands out is a noticeable lack of anything resembling a comment.
One school of thought is that a good code should be written in such a
way that the need for internal comments is drastically reduced (small
methods with limited responsibility, a lot of attention to names, and a
detailed explanation with uisage examples in the beginning of a class).

I'd say, Ruby code of most popular programs is a great pleasure to read,
even when comments are absent.
RDoc for some of these things (even many in the standard library) is a
different story though :)

Alex
 
T

Tim Hunter

Alexey said:
One school of thought is that a good code should be written in such a
way that the need for internal comments is drastically reduced (small
methods with limited responsibility, a lot of attention to names, and a
detailed explanation with uisage examples in the beginning of a class).

Yeah, I've read the reasoning behind that practice. I guess I'm just
old-school. The funny thing about the "good code should not _need_
comments" argument is that it just happens to justify what programmers have
always done, or actually not done, that is, not comment their code.

But, hey, now I'm sounding like a dour old pedant. Good Ruby code is a
pleasure to read, especially when I run across an idiom so clear and
powerful that it makes me want to start coding just so I can copy it.

And one of the things I learned at the feet of the masters is to not rely on
comments as a substitute for bad names and bad factoring.
I'd say, Ruby code of most popular programs is a great pleasure to read,
even when comments are absent.
RDoc for some of these things (even many in the standard library) is a
different story though :)

100% agree.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top