From: Kevin Olemoh Date: 2006-10-14T06:41:51+09:00 Subject: Re: What is the reason for this syntax? So I take it you all just assume that people know the same things you do? That is real smart, just assume that a person is going to be able to read your mind when he comes across your work. You cannot make the assumption that your code is going to be perfectly clear to an individual other than yourself; this would be like expecting anyone to have the exact same command of English as you do. In programming we have facilities for at the very least informing someone what a given line or block is the idea that you should not actually use this facility because whatever you wrote is going to be obvious to anyone reading your code is a joke. Actually I am asking for ruby to allow me the freedom to make my own code readable to me. I personally don't know perl so I can't comment on Perl however I will say that the interpereter should know when you are using a block and search for the do keyword or { and ignore the newline. In other words a method that requires a block as a parameter (like each) should *not* be terminated by a newline they should be terminated either by a closing brace or tne end keyword. Grabbing the user by the balls with respect to how the code is formatted is not a good thing even if it is a side-effect of how blocks work in the language. I'm sure a word processor could be written that would dissallow using a carriage return after only one sentence. You could argue that you are trying to enforce good formatting rules with respect to paragraphs, but your argument in no way invalidates the fact that people should be able to use a carriage return whenever and however they see fit. Every spoken and written language has rules and conventions however they all allow different ways to say one thing (some many more than others.) all of them probably also have examples of unnessecary rigidity however unlike programming languages spoken and written languages are not exactly engineered in a controlled environment so its not entirely possible to address those issues; it is indeed possible with programming languages. So shouldn't things that can adversly affect the readability of the language itself be addressed since it is well within human capacity to do so? On 10/12/06, Rick DeNatale wrote: > On 10/11/06, Tom Armitage wrote: > > On 07/10/06, Kevin Olemoh wrote: > > > With respect to copious amounts of comments what makes it a good idea > > > to assume that whoever else might be reading the code you have written > > > is at the same skill level as you are especially if you decide to > > > opensource your work. > > [snip] > > > Eg:Case > > > statements alot of the people I know at Uni don't really understand > > > cases so I try to put comments near my cases if I am going to be > > > sharing code with them. Or I simply tell them what this or that does > > > while I am face to face with them. > > > > I want to go back to this. > > > > Comments aren't to do with bringing people up to a skill level. > > Comments are to do with explaining things that anyone of a reasonable > > skill level couldn't work out. > > Hear, hear! > > There are are also dangers to overcommenting. > > Some years ago Gerry Weinberg wrote the classic "Psychology of > Computer Programming" and he talked about this. > > One danger is that you can fall into the trap of debugging the > comments rather than the code when something doesn't work. The > comments are really only the authors *opinion* of what the code is > supposed to be doing. If you can't write clear code, and rely on > comments to 'explain' your thinking, you, or someone who comes after > you, can be tricked into thinking that the comments are accurate, and > miss what's really happening when the code and the comments don't > agree. > > Weinberg went so far as to suggest that a useful tool would be one > which stripped source code of all comments. > > If the guys you are sharing code with don't understand the language, > either teach them or give them a book on the language. > > -- > Rick DeNatale > > My blog on Ruby > http://talklikeaduck.denhaven2.com/ > >