Comments should also tell about implicit conventions.
Remember my post on squeak dev about morphic heading I do not know the unit (degrees radians ?) I do not know the origin (toward upscreen, right ?) I do not know direction (clockwise, counter clockwise ?) Reverse engineering the code is not the fastest way to the information... As for the first person, remember objects know about themselves, this is called reflexivity (self = ego = I). Nicolas Jason Johnson a écrit : > Yea, I figured it had to do with "live objects" and everything. I just > find it a bit distracting (like as in, when you go to the theater and > they put in about 3 more previews then normal before your movie), but > it's not a big deal. > > tim Rowledge wrote: >> >> On 12-Apr-07, at 12:05 PM, Jason Johnson wrote: >> >>> >>> And what is with the first person commenting? For me it doesn't add >>> anything but typing/reading, with no value add. >>> >>> "I am the method responsible for rendering the class..." >> The tendency to first person comments stems from the anthropomorphic >> viewpoint of being inside an object. >> >> tim >> -- >> tim Rowledge; [hidden email]; http://www.rowledge.org/tim >> Useful Latin Phrases:- Die dulci fruere = Have a nice day >> >> >> _______________________________________________ >> Seaside mailing list >> [hidden email] >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside >> _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Jason Johnson-3
I'm more interested in class comments - the architectural view.
Example: WAController - OK what does it control? How does it fit with WARequest, WAResponse and the rest of it? I haven't a clue. Actually, I think this class went away in later versions (I'm still on an older version of seaside) but still, I had a lot of trouble getting the point of this class. -Todd Blanchard On Apr 12, 2007, at 12:05 PM, Jason Johnson wrote: > I'm surprised to be saying this, but one must not forget that > commenting also has a cost. My current rule is that a comment > shouldn't say what something does. If the code is so unclear that > it would need such a comment it should be rewritten (obviously if > you're doing optimized code this rule has to be relaxed a bit). > Comments should say what the code doesn't (e.g. why was it done > this way? Are there some non-obvious dependencies here?) [1]. > > And what is with the first person commenting? For me it doesn't > add anything but typing/reading, with no value add. > > "I am the method responsible for rendering the class..." > > vs. > > "responsible for rendering the class..." > > Just my $ .02, > Jason > > [1] Of course the exception to this would be Javadoc style auto > generated documentation, but that stuff is generally just for > presenting the interface of a system and thus makes me wonder if > the tests wouldn't be a better source for it. > > stephane ducasse wrote: >> >> On 6 avr. 07, at 21:01, Boris Popov wrote: >> >>> Silly question, what is it you expect commented? Methods? >> "I'm a cool method that does that and that my subclasses should >> redefine"... >> >> "I'm private method doing that. But please do not override me >> instead specialize...." >> >>> Classes? >> for each class (important) >> I want to have >> my goal >> my responsibility >> my collaborators >> my extensions hook >> may be link to examples >> Personally I do not care about my iv is a String. >> >>> Packages? Would we be better off with documentation instead? >> May be also at the package level. >> >>> If I were looking for a way to configure select list with a >>> labels block, where would I expect to find a comment for it? >> >> In a brush class comments and in the examples on the class side. >>> Look at every method in there until I see one with matching >>> comment? No offence, just trying to see how I could help out, not >>> once have I thought in the past year, jee I wish this was >>> commented, because by the time you find what you're looking for, >>> comment within it is a little late :) >> >> but commenting is not for people knowing :) >> >> Stef >>> >>> >>> Cheers! >>> >>> -Boris >>> (Sent from a BlackBerry) >>> >>> ----- Original Message ----- >>> From: [hidden email] <seaside- >>> [hidden email]> >>> To: Seaside - general discussion >>> <[hidden email]> >>> Sent: Fri Apr 06 11:53:47 2007 >>> Subject: Re: [Seaside] Why seaside really sucks! COMMMMMMMENTS >>> are MISSING >>> >>> 2007/4/6, Rick Flower <[hidden email]>: >>> > Philippe Marschall wrote: >>> > > Commit them, they will get reviewed and if accepted merged. >>> > Can I assume that this must be done in the squeak environment >>> and that >>> > it might be extra work >>> > to do this if you're using VW or other non-squeak dialects of >>> ST -- correct? >>> >>> Must is quite a strong word. I'm sure we would also accept change >>> sets >>> posted to the mailing list or mantis. >>> >>> Philippe >>> >>> > Too bad VW can't talk directly to the Squeak repository too.. >>> > >>> > _______________________________________________ >>> > Seaside mailing list >>> > [hidden email] >>> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside >>> > >>> _______________________________________________ >>> Seaside mailing list >>> [hidden email] >>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside >>> >>> _______________________________________________ >>> Seaside mailing list >>> [hidden email] >>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside >> >> _______________________________________________ >> Seaside mailing list >> [hidden email] >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside >> > > _______________________________________________ > Seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Jason Johnson-3
Jason Johnson wrote:
> I'm surprised to be saying this, but one must not forget that commenting > also has a cost. My current rule is that a comment shouldn't say what > something does. If the code is so unclear that it would need such a > comment it should be rewritten (obviously if you're doing optimized code > this rule has to be relaxed a bit). Comments should say what the code > doesn't (e.g. why was it done this way? Are there some non-obvious > dependencies here?) [1]. I disagree. Comments should introduce you to the code. If they restate the obvious that's fine, all it means is that the person reading it has an extra chance to understand what is going on (because what is obvious and what not depends on the *reader* not the writer of the comment). In addition, a well-written comment is *always* easier to understand even if the code is obvious. I find this over and over again; if I see a method that says, for example: TFrame>>allFramesDo: aBlock "Evaluate aBlock recursively with the receiver and its children" aBlock value: self. frameChildren ifNotNil:[ frameChildren do:[:fc| fc allFramesDo: aBlock]. ]. the comment says everything there is to it and reading it takes me roughly a second or two. Reading and understanding the code probably takes me 5 seconds, even when I'm familiar with the underlying code base. In situations where I am not (like Seaside) it takes *significantly* longer. Also, in general I've come to consider writing a comment a sign of basic politeness. It means: "Hey, reader, you are welcome here, I wrote a comment for you because I *want* you to understand what is going on here", contrasted with the attitude that "well if you can't tell from the code, you're probably not smart enough to understand anything here anyways, so why don't you go and use Visual Basic instead" ;-) And finally, writing the comment is a cost imposed once. Having written it once, you reap the benefits *every single time* someone looks at this code. Which, to me, is reason enough why frameworks like Seaside should have lots and lots of comments - the cost/benefit ratio is clearly on the side of writing more comments rather than less since frameworks have lots of people looking at the code. And I'm not saying I am perfect at writing comments (as some people would quickly point out to you ;-) and I am not saying that *every* method must have a comment. But I will say that -unless a comment is just plain wrong- no method or class is be better off without a comment than with a comment. Cheers, - Andreas _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Jason Johnson-3
+1
Stef On 12 avr. 07, at 21:05, Jason Johnson wrote: > I'm surprised to be saying this, but one must not forget that > commenting also has a cost. My current rule is that a comment > shouldn't say what something does. If the code is so unclear that > it would need such a comment it should be rewritten (obviously if > you're doing optimized code this rule has to be relaxed a bit). > Comments should say what the code doesn't (e.g. why was it done > this way? Are there some non-obvious dependencies here?) [1]. > > And what is with the first person commenting? For me it doesn't > add anything but typing/reading, with no value add. > > "I am the method responsible for rendering the class..." > > vs. > > "responsible for rendering the class..." > > Just my $ .02, > Jason > > [1] Of course the exception to this would be Javadoc style auto > generated documentation, but that stuff is generally just for > presenting the interface of a system and thus makes me wonder if > the tests wouldn't be a better source for it. > > stephane ducasse wrote: >> >> On 6 avr. 07, at 21:01, Boris Popov wrote: >> >>> Silly question, what is it you expect commented? Methods? >> "I'm a cool method that does that and that my subclasses should >> redefine"... >> >> "I'm private method doing that. But please do not override me >> instead specialize...." >> >>> Classes? >> for each class (important) >> I want to have >> my goal >> my responsibility >> my collaborators >> my extensions hook >> may be link to examples >> Personally I do not care about my iv is a String. >> >>> Packages? Would we be better off with documentation instead? >> May be also at the package level. >> >>> If I were looking for a way to configure select list with a >>> labels block, where would I expect to find a comment for it? >> >> In a brush class comments and in the examples on the class side. >>> Look at every method in there until I see one with matching >>> comment? No offence, just trying to see how I could help out, not >>> once have I thought in the past year, jee I wish this was >>> commented, because by the time you find what you're looking for, >>> comment within it is a little late :) >> >> but commenting is not for people knowing :) >> >> Stef >>> >>> >>> Cheers! >>> >>> -Boris >>> (Sent from a BlackBerry) >>> >>> ----- Original Message ----- >>> From: [hidden email] <seaside- >>> [hidden email]> >>> To: Seaside - general discussion >>> <[hidden email]> >>> Sent: Fri Apr 06 11:53:47 2007 >>> Subject: Re: [Seaside] Why seaside really sucks! COMMMMMMMENTS >>> are MISSING >>> >>> 2007/4/6, Rick Flower <[hidden email]>: >>> > Philippe Marschall wrote: >>> > > Commit them, they will get reviewed and if accepted merged. >>> > Can I assume that this must be done in the squeak environment >>> and that >>> > it might be extra work >>> > to do this if you're using VW or other non-squeak dialects of >>> ST -- correct? >>> >>> Must is quite a strong word. I'm sure we would also accept change >>> sets >>> posted to the mailing list or mantis. >>> >>> Philippe >>> >>> > Too bad VW can't talk directly to the Squeak repository too.. >>> > >>> > _______________________________________________ >>> > Seaside mailing list >>> > [hidden email] >>> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside >>> > >>> _______________________________________________ >>> Seaside mailing list >>> [hidden email] >>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside >>> >>> _______________________________________________ >>> Seaside mailing list >>> [hidden email] >>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside >> >> _______________________________________________ >> Seaside mailing list >> [hidden email] >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside >> > > _______________________________________________ > Seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Andreas.Raab
+1
On 13 avr. 07, at 08:52, Andreas Raab wrote: > Jason Johnson wrote: >> I'm surprised to be saying this, but one must not forget that >> commenting also has a cost. My current rule is that a comment >> shouldn't say what something does. If the code is so unclear that >> it would need such a comment it should be rewritten (obviously if >> you're doing optimized code this rule has to be relaxed a bit). >> Comments should say what the code doesn't (e.g. why was it done >> this way? Are there some non-obvious dependencies here?) [1]. > > I disagree. Comments should introduce you to the code. If they > restate the obvious that's fine, all it means is that the person > reading it has an extra chance to understand what is going on > (because what is obvious and what not depends on the *reader* not > the writer of the comment). In addition, a well-written comment is > *always* easier to understand even if the code is obvious. I find > this over and over again; if I see a method that says, for example: > > TFrame>>allFramesDo: aBlock > "Evaluate aBlock recursively with the receiver and its children" > aBlock value: self. > frameChildren ifNotNil:[ > frameChildren do:[:fc| fc allFramesDo: aBlock]. > ]. > > the comment says everything there is to it and reading it takes me > roughly a second or two. Reading and understanding the code > probably takes me 5 seconds, even when I'm familiar with the > underlying code base. In situations where I am not (like Seaside) > it takes *significantly* longer. > > Also, in general I've come to consider writing a comment a sign of > basic politeness. It means: "Hey, reader, you are welcome here, I > wrote a comment for you because I *want* you to understand what is > going on here", contrasted with the attitude that "well if you > can't tell from the code, you're probably not smart enough to > understand anything here anyways, so why don't you go and use > Visual Basic instead" ;-) > > And finally, writing the comment is a cost imposed once. Having > written it once, you reap the benefits *every single time* someone > looks at this code. Which, to me, is reason enough why frameworks > like Seaside should have lots and lots of comments - the cost/ > benefit ratio is clearly on the side of writing more comments > rather than less since frameworks have lots of people looking at > the code. > > And I'm not saying I am perfect at writing comments (as some people > would quickly point out to you ;-) and I am not saying that *every* > method must have a comment. But I will say that -unless a comment > is just plain wrong- no method or class is be better off without a > comment than with a comment. > > Cheers, > - Andreas > _______________________________________________ > Seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Andreas.Raab
Andreas Raab wrote:
> I disagree. Comments should introduce you to the code. If they restate > the obvious that's fine, all it means is that the person reading it > has an extra chance to understand what is going on (because what is > obvious and what not depends on the *reader* not the writer of the > comment). In addition, a well-written comment is *always* easier to > understand even if the code is obvious. I find this over and over > again; if I see a method that says, for example: > > TFrame>>allFramesDo: aBlock > "Evaluate aBlock recursively with the receiver and its children" > aBlock value: self. > frameChildren ifNotNil:[ > frameChildren do:[:fc| fc allFramesDo: aBlock]. > ]. > > the comment says everything there is to it and reading it takes me > roughly a second or two. Reading and understanding the code probably > takes me 5 seconds, even when I'm familiar with the underlying code > base. In situations where I am not (like Seaside) it takes > *significantly* longer. thought like recursion is a good idea. I'm just talking about when someone writes huge books for every method, complete with fancy ASCII art headers and such (for every method!). Of course, that kind of brain dead practice is much more common in other languages, but I figured I would throw it out there since no one else did. :) > Also, in general I've come to consider writing a comment a sign of > basic politeness. It means: "Hey, reader, you are welcome here, I > wrote a comment for you because I *want* you to understand what is > going on here", contrasted with the attitude that "well if you can't > tell from the code, you're probably not smart enough to understand > anything here anyways, so why don't you go and use Visual Basic > instead" ;-) Well, it's not my opinion that if you can't understand my code you're an idiot. It is more my opinion that if you can't read my code then I need to write clearer code (that is, it's an insult to me not you). Some comments save time, but we have other things that save time as well (e.g. method categories). > And finally, writing the comment is a cost imposed once. Having > written it once, you reap the benefits *every single time* someone > looks at this code. Which, to me, is reason enough why frameworks like > Seaside should have lots and lots of comments - the cost/benefit ratio > is clearly on the side of writing more comments rather than less since > frameworks have lots of people looking at the code. Again, I was talking about the cost of having to *read through the comments*. I wasn't thinking about time spent writing the comments at all. Seaside for sure needs to have some obvious documentation of what the interfaces are, methods people would be interested in, what they never would look at and so on. And much of this can be helped by a method categorizing convention (i.e. certain categories are always interface, some always private/volatile/experimental/etc.). > > And I'm not saying I am perfect at writing comments (as some people > would quickly point out to you ;-) and I am not saying that *every* > method must have a comment. But I will say that -unless a comment is > just plain wrong- no method or class is be better off without a > comment than with a comment. > > Cheers, > - Andreas > _______________________________________________ > Seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Nicolas Cellier-3
nicolas cellier wrote:
> Comments should also tell about implicit conventions. > Remember my post on squeak dev about morphic heading > > I do not know the unit (degrees radians ?) > I do not know the origin (toward upscreen, right ?) > I do not know direction (clockwise, counter clockwise ?) > > Reverse engineering the code is not the fastest way to the information... > > As for the first person, remember objects know about themselves, this > is called reflexivity (self = ego = I). > > Nicolas shouldn't have to dig through source to find out what a method is called with. I'm not against documentation and I'm not against comments. But I mean, just because something is a comment doesn't mean it is good. It is possible to write bad comments as well (e.g. commenting every line telling what that line does. We're not coding in assembler after all). So to phrase it another way: Good comments are good, bad comments are bad. :) _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by tblanchard
Todd Blanchard wrote:
> I'm more interested in class comments - the architectural view. > > Example: WAController - OK what does it control? How does it fit with > WARequest, WAResponse and the rest of it? I haven't a clue. > Actually, I think this class went away in later versions (I'm still on > an older version of seaside) but still, I had a lot of trouble getting > the point of this class. > > -Todd Blanchard > I agree. I would expect every class to have a comment (unless the classes are clearly a very specialized subclass with a name expressive enough that you understand). For me, that's why they have a comment pane and a red "No comment!" message. :) _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Jason Johnson-3
For me, the whole thing about comments is very simple. I use Prototype
almost exclusively for most scripting here. Do I ever look at the source code? Yes, on occasion. Do I look at it to figure out how to use it? No, because there's http://www.prototypejs.org/api instead. Let's figure out a good model for creating simple straightforward documentation similar to that one and invite contributions. I know I could spend few minutes every week writing up comments and examples and if all of us did it, we'd have decent documentation in no time. Cheers! -Boris -- +1.604.689.0322 DeepCove Labs Ltd. 4th floor 595 Howe Street Vancouver, Canada V6C 2T5 http://tinyurl.com/r7uw4 [hidden email] CONFIDENTIALITY NOTICE This email is intended only for the persons named in the message header. Unless otherwise indicated, it contains information that is private and confidential. If you have received it in error, please notify the sender and delete the entire message including any attachments. Thank you. > -----Original Message----- > From: [hidden email] [mailto:seaside- > [hidden email]] On Behalf Of Jason Johnson > Sent: Friday, April 13, 2007 10:12 AM > To: Seaside - general discussion > Subject: Re: [Seaside] Re: Why seaside really sucks! COMMMMMMMENTS are > MISSING > > nicolas cellier wrote: > > Comments should also tell about implicit conventions. > > Remember my post on squeak dev about morphic heading > > > > I do not know the unit (degrees radians ?) > > I do not know the origin (toward upscreen, right ?) > > I do not know direction (clockwise, counter clockwise ?) > > > > Reverse engineering the code is not the fastest way to the > information... > > > > As for the first person, remember objects know about themselves, > > is called reflexivity (self = ego = I). > > > > Nicolas > Yes, those are good things that need to be documented. And no, one > shouldn't have to dig through source to find out what a method is called > with. I'm not against documentation and I'm not against comments. But > I mean, just because something is a comment doesn't mean it is good. It > is possible to write bad comments as well (e.g. commenting every line > telling what that line does. We're not coding in assembler after all). > > So to phrase it another way: Good comments are good, bad comments are > bad. :) > _______________________________________________ > Seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Jason Johnson-3
> I agree. I would expect every class to have a comment
> (unless the classes are clearly a very specialized subclass > with a name expressive enough that you understand). For me, > that's why they have a comment pane and a red "No comment!" > message. :) _______________________________________________ Or at least, all the classes at the root of the family. Just understanding how all the abstract classes work together and how they're expected to be specialized in subclasses goes a long way in groking a framework. Ramon Leon http://onsmalltalk.com _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Ramon Leon wrote:
>> I agree. I would expect every class to have a comment >> (unless the classes are clearly a very specialized subclass >> with a name expressive enough that you understand). For me, >> that's why they have a comment pane and a red "No comment!" >> message. :) _______________________________________________ >> > > Or at least, all the classes at the root of the family. Just understanding > how all the abstract classes work together and how they're expected to be > specialized in subclasses goes a long way in groking a framework. Thanks Ramon, that is what I was trying to say in my parenthesis. This getting up at 4am stuff (at least I hope that's the problem!) is not helping my expression clarity at all. :) _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Jason Johnson-3
Jason Johnson wrote:
> Yes, a short to the point comment like that in something that takes some > thought like recursion is a good idea. I'm just talking about when > someone writes huge books for every method, complete with fancy ASCII > art headers and such (for every method!). Of course, that kind of brain > dead practice is much more common in other languages, but I figured I > would throw it out there since no one else did. :) Well, I'll gladly have *that* problem :-) And I'll happily trade a few hundred overly lengthy comments against the 250+ uncommented classes and 2500+ uncommented methods in Seaside ;-) > Well, it's not my opinion that if you can't understand my code you're an > idiot. It is more my opinion that if you can't read my code then I need > to write clearer code (that is, it's an insult to me not you). Some > comments save time, but we have other things that save time as well > (e.g. method categories). True. I still think there is a difference when people write a comment though, because it implies that they realize others will look at this code (and the knowledge that other people will look at your work has been shown to have an effect on how humans act; it wouldn't surprise me if there were actually a correlation between comments and quality of code). > Again, I was talking about the cost of having to *read through the > comments*. I wasn't thinking about time spent writing the comments at > all. Oh, wow. Have you truly ever been in a situation where you've really felt that reading the comments wasn't worth it? Not on a small scale (I'm sure there are a few methods for which the comments are inadequate) but on a scale of a framework like Seaside. A situation where you'd rather been without any comments to begin with? I find it hard to even imagine what code must look like which has been "commented to death" (if you have an example I'd really love to check it out). Usually, that's not exactly the kind of problem I face ;-) Cheers, - Andreas _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |