資源描述:
《Coding Guidelines for Cocoa.pdf》由會員上傳分享,免費在線閱讀,更多相關內(nèi)容在學術論文-天天文庫。
1、CodingGuidelinesforCocoaContentsIntroductiontoCodingGuidelinesforCocoa5OrganizationofThisDocument5CodeNamingBasics6GeneralPrinciples6Prefixes8TypographicConventions8ClassandProtocolNames9HeaderFiles9NamingMethods11GeneralRules11AccessorMethods12DelegateMethods14CollectionMethods15MethodArgumen
2、ts16PrivateMethods17NamingFunctions18NamingPropertiesandDataTypes19DeclaredPropertiesandInstanceVariables19Constants20Enumeratedconstants20Constantscreatedwithconst21Othertypesofconstants21NotificationsandExceptions22Notifications22Exceptions23AcceptableAbbreviationsandAcronyms24TipsandTechniq
3、uesforFrameworkDevelopers26Initialization262013-10-22
4、Copyright?2003,2013AppleInc.AllRightsReserved.2ClassInitialization26DesignatedInitializers27ErrorDetectionDuringInitialization27VersioningandCompatibility28FrameworkVersion28KeyedArchiving29ExceptionsandErrors29FrameworkData31ConstantData31
5、Bitfields31MemoryAllocation32ObjectComparison33DocumentRevisionHistory342013-10-22
6、Copyright?2003,2013AppleInc.AllRightsReserved.3ListingsTipsandTechniquesforFrameworkDevelopers26Listing1Errordetectionduringinitialization28Listing2Allocationusingbothstackandmalloc’edbuffer322013-10-22
7、Copyrigh
8、t?2003,2013AppleInc.AllRightsReserved.4IntroductiontoCodingGuidelinesforCocoaDevelopingaCocoaframework,plug-in,orotherexecutablewithapublicAPIrequiressomeapproachesandconventionsthataredifferentfromthoseusedinapplicationdevelopment.Theprimaryclientsofyourproductaredevelopers,anditisimportantth
9、attheyarenotmystifiedbyyourprogrammaticinterface.ThisiswhereAPInamingconventionscomeinhandy,fortheyhelpyoutomakeyourinterfacesconsistentandclear.Therearealsoprogrammingtechniquesthatarespecialto—orofgreaterimportancewith—frameworks,suchasversioning,binarycompatibility,error-handling,andmemorym
10、anagement.ThistopicincludesinformationonbothCocoanamingconventionsandrecommendedprogrammingpracticesforframeworks.OrganizationofThisDocumentThearticlescontainedinthistopicfallintotwogeneraltypes.Thefirstandlargergrouppresentsnamingconve