16, provide "all-round initialization method"
Provides an all-in-one initialization method in the class and is indicated in the document. This method should be called by the other initialization methods.
If the almighty initialization method differs from the superclass, the corresponding method in the superclass should be covered.
If the initialization method of the superclass does not apply to subclasses, then the superclass method should be covered and an exception thrown.
17 Implementing the Description method
Implements the description method, returning a meaningful string that describes the instance
-(NSString *) description{
return [NSString stringwithformat:@ "<%@:%p,%@>",
[Self class],
Self
@{@ "title": _title,
@ "Latitude": @ (_latitude),
@ "Longitude": @ (_longitude)}
];
}
If you want to print more detailed object description information during debugging, you should implement the Debugdescription method.
18. Try to use immutable objects
Try to create immutable objects.
If an attribute can only be modified inside an object, it is extended from the ReadOnly property to the ReadWrite property in the Class-continuation category.
Instead of exposing immutable collection as attributes, you should provide a method to modify the immutable collection in the object.
19 using a clear and coordinated naming method
It is easier for developers to understand the interface that is created by complying with the standard OBJECTIVE-C naming specification when naming.
The method name is concise, reading from left to right like the sentence in everyday language is good.
Do not use the abbreviated type name in the method name.
The first thing to do when naming a method is to make sure its style matches your own code or the framework that you want to integrate.
20 prefix the Private method name
Prefix the private method name so it is easy to separate it from the public method.
Do not use an underscore as the prefix for private methods, as this is reserved for Apple.
52 Essentials of iOS development summary of four