What are Properties and how do they work?   2 comments


Difficulty: easy moderate challenging

Properties are a way for programmers to simplify the use – or to perhaps minimize the misuse – of handling instance variables, especially in regard to how their memory management is being done. Although properties support scalar C data variables such as BOOL, int, etc., their strength exhibits while dealing with NSObjects, when memory management becomes an issue. If you ever noticed properties and didn’t quite understand what the heck, than I would start by saying that properties are not so complicated as they seem at first and there is no voodoo happening that makes them work – they are merely a different syntactic notation for what you normally code in Objective-C. Properties modify two aspects of your code: 1) they streamline how users of a class access its variables, 2) they simplify memory management for classes, by minimizing or even omitting implementation details of the variables’ memory management. If the previous sentence or even the entire paragraph were difficult to understand, read it again after finishing the article and then see if it makes sense.

Read the rest of this entry »

Advertisements

How to Properly Encapsulate Your Classes in Objective-C   1 comment


Difficulty: easy moderate challenging

The main task of a programmer is not simply to create code that works, but perhaps even more important, to create code that’s manageable, adaptable to new requirements, and allows easy debugging. These qualifications are intended to help programmers, either the original coder or his or her colleagues, to better support the code; the CPU doesn’t need any help – it knows precisely how to handle all instructions, be them cluttered or neat. So, to be able to support those requirements, we strive to divide big chunks of code into separate files, functions, and lines.
Read the rest of this entry »

Integrating Your Source Control System with Thy Bug-Tracker   Leave a comment


Difficulty: easy moderate challenging

In our day and age, working with a source control system and a bug-tracker is a must. The benefits of using each are clear and enormous. Even when you work on a small project alone, using one or even both options is useful. Combining them is extremely valuable, as you’ll soon discover.
Read the rest of this entry »

To use or not to use: Assertions   Leave a comment


Difficulty: easy moderate challenging Too many times I found out that programmers rarely and somewhat incorrectly use assertions. Hopefully this quick guide will help you understand how to avoid being one of those. As a rule of thumb, a programmer needs to put guards around his code to take into account inappropriate input and act accordingly. Sometimes, he might run into corrupted data from the network, invalid input from your user, or even getting his objects into unintended states. All of these should be somehow guarded against. He can use if statements accompanied with return, exit, pop-up alerts, throwing exception, or working around those issues. But, sometimes, these guards can be redundant, excessive, and not likely to happen in real life. Read the rest of this entry »

Symbolication (or how to analyze Apple’s crash logs) under the hood   Leave a comment


Difficulty: easy moderate challenging

If you ever have experienced crashes of your app and would like to fix them, you would like to be able to analyze crashes.

Crashes that happen on the same Mac you are compiling are automatically being intercepted, interpreted, and displayed using GDB.
Read the rest of this entry »

Posted October 7, 2010 by Ohad Kravchick (myok12) in iOS Programming

Tagged with , , , , , ,

%d bloggers like this: