• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: "Tricks" of the "Trade"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "Tricks" of the "Trade"


  • Subject: Re: "Tricks" of the "Trade"
  • From: Georg Tuparev <email@hidden>
  • Date: Thu, 7 Jun 2001 09:25:44 +0200

On Thursday, June 7, 2001, at 02:15 AM, Erik Thorteran wrote:

5. Comment code, always. You may notice that the aforementioned single line of code has no comments, this is one of the reasons it was such a pain to debug.


Hmmm. Here is a quote from Martin Fowler's Refactoring book:
"The reason we mention comments here is that comments often are used as a deodorant [for smelly code - gt]. It's surprising how often you look at trickly commented code and notice that the comments are there because the code is bad"

My advise: do not use comments, but use proper method and variable names. One of the beauties of ObjectiveC is that (similar to Smalltalk) it is a self commenting language (if used properly). My colleagues and I use comments in three situations:
1. To document public API (in the header file)
2. For mathematical expressions (a formula is more compact and readable then several lines of code)
3. To mark some source fragment to be changed or enhanced in the future. I start such comments with "$$$" so that I can search for this pattern in the entire project. Some folks are also using the #warning pragma, but this should not be misused.

Just my $0.02

Georg Tuparev
Tuparev Technologies
Klipper 13
1186 VR Amstelveen
The Netherlands
Mobile: +31-6-55798196


References: 
 >"Tricks" of the "Trade" (From: Erik Thorteran <email@hidden>)

  • Prev by Date: Re: "Tricks" of the "Trade"
  • Next by Date: Re: "Tricks" of the "Trade"
  • Previous by thread: "Tricks" of the "Trade"
  • Next by thread: Re: "Tricks" of the "Trade"
  • Index(es):
    • Date
    • Thread