On Jul 24, 2011, at 2:41 PM, Tom Jeffries wrote: > Jens, I'm sorry if my naming conventions confuse you. I've been programming > for 27 years on a wide variety of operating systems, and I'm afraid > following Cocoa naming conventions is not high on my list.
One does not follow from the other. If you want help from experienced Cocoa developers it wouldn't hurt to make your code easy for them (not to mention possible future collaborators) to read. It's not about passing judgment on how much experience you have. It's about making it easier for us to help you. Every platform/language/library has its conventions, which should be thought of as an aid to communication rather than a burden. Cocoa's are not hard to adhere to. > I thought [SequeraStepWindow awakeFromNib] makes it obvious that > SequeraStepWindow is a class. Is there a way to use that syntax with a > variable? If so, Objective C gets a major thumbs down. I cannot tell what you saying/asking here. The syntax makes it clear that you are sending a message. If you had adhered to Cocoa coding conventions we would probably *guess* that SequeraStepWindow is a class. But since you don't, we can't tell if it's a class or a variable -- or for that matter, if it is a variable, whether it contains a reference to a class or a reference to an instance. You should know that it is most certainly possible to use that syntax with a variable. For example: NSString *myString = @"abc"; // <== a variable NSString *newString = [myString copy]; // <== a message send You can send messages to both classes and instances of classes. If you are not clear about the difference between a class and an instance, let us know now so we can proceed on the same page. > The program compiles without warnings. Obviously I dealt with that level > before posting a question here. No. If you didn't tell us, it wasn't obvious. Obviously that's why the question was asked. --Andy > > > Thanks, Tom > > > On Sun, Jul 24, 2011 at 10:45 AM, Jens Alfke <j...@mooseyard.com> wrote: > >> >> On Jul 24, 2011, at 10:11 AM, Tom Jeffries wrote: >> >> + (BOOL) Play >> >> >> It’s hard to tell what’s going on in the code when you’re not following >> Cocoa naming conventions. Methods should start with a lowercase letter >> (unless they begin with a common acronym like “URL”). >> >> I’m very strongly in favor of prefixing (or postfixing) instance variables >> with something like “_” or “m_” to distinguish them from other variables. >> This makes it a lot easier to look at code and quickly identify what a >> variable is, as in these snippets. (It’s not a universal convention, though, >> although I will note that Apple strongly follows it in its own code.) >> >> [self DrawNotes]; // this is where the drawing takes place >> >> >> Do you mean that the -DrawNotes method actually draws stuff? It shouldn’t; >> that should happen in -drawRect:. >> >> //[SequeraStepWindow awakeFromNib]; >> >> //[SequeraStepWindow setNeedsDisplay: YES]; >> >> >> What is SequeraStepWindow? A class or a variable? It’s capitalized so I >> assume a class, but both of those are instance methods, so they won’t work >> when called on a class (and will generate compiler warnings.) >> >> * Does your code build without warnings? If not, fix the warnings first. >> Very important; a lot of serious errors in Obj-C only get reported as >> warnings. >> * Have you set an all-exceptions breakpoint? There are cases in which an >> exception thrown from your code can be caught by AppKit and not reported >> back to you, so it just looks as though nothing happens. >> >> This is getting messy enough that maybe you should just upload a zip file >> of your whole project, or at least the relevant source files, and post the >> URL... >> >> —Jens >> > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > 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: > http://lists.apple.com/mailman/options/cocoa-dev/aglee%40mac.com > > This email sent to ag...@mac.com _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com