Profile

Cover photo
Robert Brown
83 followers|79,987 views
AboutPosts

Stream

Robert Brown

Shared publicly  - 
 
Sometimes when programming, we encounter impossible situations. Unfortunately, the compiler isn’t as smart as we are. It can’t identify impossible situations like we can. For these situations, we can ...
1
Add a comment...

Robert Brown

Shared publicly  - 
 
Clang added several features to the Objective-C language. One of these features is the ‘instancetype’ keyword. When creating objects, we frequently use methods in the alloc and init families. They hav...
1
Add a comment...

Robert Brown

Shared publicly  - 
 
Take control of how people and web services communicate with you via email.
If you are anything like me, you probably have more than one email account. One account is only for trusted friends and colleagues. The other is for everyone else. I am always paranoid that I will get...
1
Add a comment...

Robert Brown

Shared publicly  - 
 
RBSmartTableViewCell for iOS makes creating custom table view cells easy. https://github.com/rob-brown/RBSmartTableViewCell
1
Add a comment...

Robert Brown

Shared publicly  - 
 
BYU CocoaHeads presentation that introduces Automatic Reference Counting for Mac/iOS.
1
Matthew Murdock's profile photoRobert Brown's profile photo
2 comments
 
tl;dr Use ARC but also know how to do manual memory management.

Personally, I think that manual memory management is very easy. However, personal experience over the last two and a half years has shown me that very few developers can manage memory properly. Since this is the case, I recommend ARC to all developers, especially anyone new to Objective-C.

ARC being "perfect" is entirely subjective. I have never run into any reference counting problems with ARC. However, there are some corner cases to watch out for. For example, all Objective-C objects are put on the heap, except for blocks. Blocks are initially put on the stack, but can be moved to the heap. ARC is built to handle reference counting, not de-stackifying blocks. By handling reference counting, ARC naturally de-stackifies blocks in most cases. There is at least one case it does not handle. This can be viewed as a flaw in ARC, but it is an entirely different problem from reference counting. Though I expect it wouldn't be too hard to get ARC to properly de-stackify blocks too. I would love to have ARC handle this too.

ARC also doesn't handle C memory management. So, if you do anything with AVFoundation, Core Graphics, etc you will need to handle the memory management anyway. I personally don't mind this since memory management is quite easy.

Another issue is that ARC doesn't handle retain loops. However, ARC or not, reference counting always has this problem. Fortunately, Apple has added a weak referencing system to solve the problem.

The key to ARC is you need to learn to trust it, just like you trust a garbage collector (garbage collectors can be flawed too). I personally trust ARC more than any garbage collector. I love doing crazy things with threads. Despite all the use cases I have encountered with threads, I have never had a dangling pointer or memory leak using ARC. Memory management in a multi-threaded environment can be very difficult, and it requires knowledge beyond the basics, especially with autorelease.

Even when using ARC, developers can have memory problems. The problems, however, stem not from ARC but from the developer. Objective-C has some very strong conventions. If a developer doesn't follow the conventions, then ARC can't help them. The most common example of this is knowing when to use copy or strong with an @property. Though, ARC or not, if they mix up copy and strong, they are going to have problems anyway.

</novel>
Add a comment...

Robert Brown

Shared publicly  - 
 
New Design Pattern: Read/Write Lockless Exclusion Accessor
Read/Write Lockless Exclusion. With the recent release of iOS 5, GCD now has a simple and elegant solution to the reader writer problem that utilizes lockless exclusion. In summary, this involves usin...
1
Add a comment...
Have him in circles
83 people
Justin York's profile photo
Miguel Bonilla's profile photo
Cole Joplin's profile photo
Randy Jones's profile photo
Stephen Lottermoser's profile photo
Brandon Reid's profile photo
Jeremy Stone's profile photo
Shan Nah's profile photo
David Compton's profile photo

Robert Brown

Shared publicly  - 
 
Swipe Music is now in the App Store. https://itunes.apple.com/us/app/swipe-music/id570457491?mt=8
1
Add a comment...

Robert Brown

Shared publicly  - 
 
RBStoryboardLink makes it easy to connect separate storyboards without writing any code. 
1
frances ottewell's profile photo
 
hey elder brown, how are you? what are you doing these days?  take care, fran ottewell
Add a comment...

Robert Brown

Shared publicly  - 
 
App review of PaintCode made by PixelCut.
1
Add a comment...

Robert Brown

Shared publicly  - 
 
Millions of Americans oppose SOPA and PIPA because these bills would censor the Internet and slow economic growth in the U.S.. Two bills before Congress, known as the Protect IP Act (PIPA) in the Sena...
1
Add a comment...

Robert Brown

Shared publicly  - 
 
UIStoryboard best practices. A must read for all iOS developers.
UIStoryboard is a hot topic right now in iOS. However, there have been many misconceptions on the topic. The first reaction to storyboards (what I have seen anyway) is that they are a panacea for all ...
1
Add a comment...

Robert Brown

Shared publicly  - 
 
My tribute to Steve.
A Tribute to Steve Jobs. The world is mourning the loss of a great man. I just hope that his great vision has not been lost as well. Steve lived his dreams. He was never content and continually pushed...
1
Add a comment...
People
Have him in circles
83 people
Justin York's profile photo
Miguel Bonilla's profile photo
Cole Joplin's profile photo
Randy Jones's profile photo
Stephen Lottermoser's profile photo
Brandon Reid's profile photo
Jeremy Stone's profile photo
Shan Nah's profile photo
David Compton's profile photo
Links
Contributor to
Basic Information
Gender
Male