Re: Inviting to comment on Cocoa categories
Re: Inviting to comment on Cocoa categories
- Subject: Re: Inviting to comment on Cocoa categories
- From: Graham Cox <email@hidden>
- Date: Mon, 10 Nov 2008 10:07:59 +1100
On 10 Nov 2008, at 5:47 am, Tommy Nordgren wrote:
// TN+NSAffineTransform.h
@interface NSAffineTransform (TNGraphics)
A comment on naming conventions. It doesn't matter that much
especially if you are just using them privately, but there's an
inconsistency here. Usually I name category files primarily by the
class they are a category on + the name of the category:
NSAffineTransform+TNGraphics.h
This seems to be a widely adopted convention.
Doing this allows you to see at a glance that the file contains
functions which extend NSAffineTransform, which you might miss if the
name doesn't start with the class. I tend to work with a narrowish
files column in Xcode which truncates long filenames, so I find this
helps there too.
+(NSAffineTransform *) transformRotatedAroundPoint:(NSPoint) p
degrees:(CGFloat) deg;
A handy method, but I wonder if it could be named to be more readable
with respect to its actual function, for example:
+ transformWithPoint:rotatedByDegrees:
this way each section of the method name is a functional description
in its own right, whereas degrees: isn't (though in this case it's
easy to guess what is wanted there). Also, it's not the transform that
is rotated, so +transformRotatedAroundPoint: is not an accurate
description of what the method returns. However I'm sure this could be
improved upon further, just my first thought.
--Graham
_______________________________________________
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