cocoa - "Private methods" or static functions in Objective-C. Which one should I use? -
I ended up with a programming style suspicion which is a better solution to this problem (in terms of style) ? To use a category and to declare it in the .in file in the interface @ Interface or go with a static job achieving an object.
Thanks
If you do not have an immediate answer that is to use, So like the function.
I spend most of the time (> 90%) of the function.
The methods are useful for polymorphism and interface.
There are other ideas for each:
Functions are usually small, fast and the ability to inline them in the compiler, if there is no reason to cause any problems using any method And you do not need to use any exclusive in-class, go with the function.
Methods (or categories, if you want) if you do not want an accessor overhead or want some other feature that is available in the intensification method, like @Synchronize. In my programs, there is very little scope for these features, and generally there is no need to use methods.
Ways to export additional symbols, and usually have a high (but smaller) overhead, consequently they generally make the binary a little bigger and executable slightly (usually not Seen, unless you often use them).
There is also a risk in using / making personal methods, can apply / declare the method in that receipt / subclasses. This is often an unnecessary risk. I like the compiler / linker to sort it for me, instead of knowing that it is hitting a strange case on runtime after 2 weeks of shipping (and difficult to detect the problem). The methods can also be useful if you intend to make the interface some time in advance.
Comments
Post a Comment