One topic to mention as special in Objective C is its memory management. It becomes more important in developing for iOS than OS X, as there is no garbage collection process due to limitation of resources. What is special here about memory management is reference counting. This concept seems to be problematic at first, but once you realize how it works, memory concerns become even easier to deal with in comparison with languages in which memory issues are handled automatically. For instance, in Java, developer must think of objects’ life cycles. In programs that use a great number of complex objects, it becomes challenging to keep track of all references to an object. Whereas in Objective C, that you should explicitly take and release ownership of an object, all that needs to be taken care of is releasing the ownership of an object, that you own, and that you do not need anymore. This way, memory allocated to an object is handled within the scope of that object. Therefore, new owners from outside of that scope (for instance, when an object returned by a method is being retained) do not need to pay any attention to what is happening in that scope.
No comments:
Post a Comment