Re: Code style
Re: Code style
- Subject: Re: Code style
- From: Conrad Shultz <email@hidden>
- Date: Thu, 02 Jun 2011 12:05:14 -0700
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 6/2/11 11:38 AM, Jens Alfke wrote:
> There’s a lot of Google’s code style that I hate, and I wouldn’t hold it
> up as something everyone should follow. (The 80-character line length
> and 2-space indents are particularly infuriating.)
Sorry, perhaps I wasn't clear. I was NOT holding out Google's style
guide as authoritative in entirety; I was pointing out that for the
particular matter of method declaration spacing its formal guideline
matches what Apple informally promulgates (by choice of style in their
docs and header files).
> Personally, I find it more readable to have spaces after the “:”s in
> message expressions.
Fair enough; if you have a particular readability concern and have at
least standardized internally then who am I to disagree? But the OP to
whom I was responding appeared (to me) to not have developed a
particular coding style of choice, and I was directing them to follow
Apple's lead, which, absent extenuating circumstances, is probably the
best option.
> IMHO it’s not worth trying to standardize where people put spaces in
> their lines. Everyone has a different opinion and it just leads to
> religious wars.
And it's not a battle I wish to wage. (I considered replying to the OP
off-list, but chose to go public so that they could benefit from others'
experience - I have no desire to prove that "my way is right.")
(I also carefully avoided the verboten dilemmas such as: does the
opening brace go on the same or subsequent line?)
(And before anyone gets any ideas, the foregoing was rhetorical; please,
for the love of all that is good in the world, don't start a thread on
this matter!)
> But naming conventions are important. Lowercase method names are pretty
> universally used. I’m also strongly in favor of distinguishing instance
> variable names with a leading or trailing underscore, because it
> eliminates a lot of confusing ambiguities when reading code.
Unlike the space issue, both of these ARE addressed in the official
Cocoa style guidelines: lowercase is advised and leading (but not
trailing) underscores are reserved for use by Apple to avoid collision
in the private namespace.
- --
Conrad Shultz
Synthetiq Solutions
www.synthetiqsolutions.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iD8DBQFN597paOlrz5+0JdURAuauAJ9TsRXvzKcUpVodiiIfftgV66Q09QCfZlhO
7cLurrQPD8XJ4aM4cd5FoO0=
=d8uZ
-----END PGP SIGNATURE-----
_______________________________________________
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