• 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: Constructive Criticism
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Constructive Criticism


  • Subject: Re: Constructive Criticism
  • From: Alastair Houghton <email@hidden>
  • Date: Tue, 6 Oct 2009 22:48:02 +0100

In addition to Bill's comments, which covered most things I think...

On 6 Oct 2009, at 22:26, Mick Walker wrote:

int g = Year % 19;
int c = Year / 100;
int h = h = (c - (int)(c / 4) - (int)((8 * c + 13) / 25) + 19 * g + 15) % 30;
int i = h - (int)(h / 28) * (1 - (int)(h / 28) * (int)(29 / (h + 1)) * (int)((21 - g) / 11));

day = i - ((Year + (int)(Year / 4) + i + 2 - c + (int)(c / 4)) % 7) + 28;

You *do* know that in C the "/" operator will do *integer* division unless one of the quantities is floating point, right? So there's no need for all of those "(int)" casts.


And I'd be inclined to give my variables meaningful names, rather than "g", "c", "h" and "i"...

Oh, and since I'm in the dot-syntax-is-evil camp, s/self.year/[self year]/g in Bill's code :-D :-D

Of course, not everyone agrees with me on that (there are many respected developers on both sides of the argument), but I *intensely* dislike the fact that the syntax looks like member variable access (though if you look closely, of course, it becomes apparent that it isn't) while simultaneously sending messages---which can in general have side effects.

(As you've probably realised by now, a lot of the changes being suggested are stylistic.)

Kind regards,

Alastair.

--
http://alastairs-place.net




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Constructive Criticism
      • From: Derek Chesterfield <email@hidden>
References: 
 >Constructive Criticism (From: Mick Walker <email@hidden>)

  • Prev by Date: Re: Constructive Criticism
  • Next by Date: Re: NSSecureTextField - changing the default bullets to ****
  • Previous by thread: Re: Constructive Criticism
  • Next by thread: Re: Constructive Criticism
  • Index(es):
    • Date
    • Thread