auto reference counting with iOS 5.0

iOS 5.0 introduced us to ARC for mobile. this is a major change (advantage) in the way developers  work. what was once a source for memory leaks, which required diligent memory allocation and management, becomes easier and much simpler of a task, allowing developers to focus on the code.

LLVM rocks indeed.

think of it as new ‘best practices’ one should incorporate into their coding habits, while disallowing other practices:

  • no more retain, release, autorelease nor dealloc
  • no more custom retain nor release method implementations
  • do not store obj pointers in C structures (use objects instead)
  • no more direct casting between objects and non objects (e.g. id and void*)
  • you are done with NSAutoreleasePool. use @autoreleasepool keyword to mark the block in curlies.

what ARC should encourage you to do is start thinking about the relationship between objects and object graphs, and not so much in terms of retain/release. there is now a new lifetime qualifiers for objects, which includes zeroing weak references. the value is automatically set to nil when the object it points to is deallocated. we now have qualifiers for vars and new weak and  strong declared property attributes.

apple is providing developers with migration tools which are build into xcode: .

switching to ARC means neglecting support for iOS >5.0.
add custom containers to the mix, much more control over customizing UIKit elements, storyboards, tableView’s new flexibility and much more.

happy coding.


our brains need the time to reset just like the gadgets and computers we use and operate. by experimentation i’ve learned that a minimum of 2-3 weeks vacation twice a year pretty much does the trick. think about it, in today’s day and age we are always on, always connected, always tapping into sources of data to keep us engaged. from the moment we wake up and check our smart phone which aggregates data from multiple social and professional networks, to email, text and voice mail – we are constantly engaging with our peers, families and consume multiple sources of data, easily streamlined for our convenience, easily shared and re-propagated. and this is just the digital disturbance 🙂

the human story for today is our need to focus. the need to do just one thing at a given moment and stick with it for many hours. developers know how to do so (hey nir, can you turn off the music and ask andrew to put his headphones on please?). i know that for me playing music does the trick and specifically practicing yoga. calming the mind is an art that requires constant and un interrupted practice. i cannot imagine the brain enjoying 100% capacity at any given moment, just as much as it enjoys 0% capacity. the truth is pretty much always in the middle. face it, we have learned to respond to these interruptions better than focus, and it goes back to the days where the telephone was invented.

sleeping is the best time for the brain to not consume new streams of data and process all it has been bombarded with, make new connections and archive/store the data. from a quick survey with close friends and family, i learn that sleeping patterns are very much affected and do worsen with time. how many of you out there in the internets sleep with the TV on?

this is why i take two long breaks from my work and focus on relaxing my mind and body, explore new geographical areas of our planet, meet new people, study a new language, and more often then not play/write music and expand my photography skills. this works in phases though and i find that it takes some time to re-adjust the mind and relax – slow down. the longest break i have ever taken from life was a 3 months trip to brasil. no iphone, no laptop, no internet connection. would you be surprised if i told you that it did not take long to re-adjust to the new situation and that i loved it? i took my best photos and wrote my best music while taking these breaks from life.

much like a hard reset, browser cache cleaning and the application of a new style sheet – one may immerge back with fresh energy and a newly re-wired brain. so – for the sake of your career, mental health and own happiness – plan on taking a longer time off. you deserve it.