Re: Inviting to comment on Cocoa categories
Re: Inviting to comment on Cocoa categories
- Subject: Re: Inviting to comment on Cocoa categories
- From: Tommy Nordgren <email@hidden>
- Date: Mon, 10 Nov 2008 03:01:51 +0100
On 10 nov 2008, at 00.07, Graham Cox wrote:
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
Good point.
A better name would probably be:
+ transformRotatingAroundPoint: byDegrees.
I will change it so.
I don't think the name you suggested accurately describes that the
supplied point is the origin of the rotation.
----------------------------------
The three things an undertaker should never say to a client:
-Nice doing business with you.
-Welcome back.
-Have a nice day. (The King of ID)
----------------------------------
Tommy Nordgren
email@hidden
_______________________________________________
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