Day 2 – Saturday
Saturday was the first full day of class. Breakfast was served at 8:30. Given my wife and I had our first child back in June and this was my first night sleeping away from them in quite some time, I’m amazed I didn’t oversleep. The first day was spent mainly covering the basics of Objective C. This included things like classes, inheritance, etc. Objective C has some nuances that allow you to do similar things in other languages…just in a slightly different way.
A good example of an interesting Objective C feature is Objective C’s extension classes (not to be confused with C# extensions). Extension classes are basically interfaces that can only be implemented in a given class. For example, if you have a class called Car, your extension class to Car might be in a file called Car+YourExtension. Odd, I know.
The benefit for having an extension class is that anything in the extension does not show up in the parent class’s documentation. So if you have an extension method on Car called SelfDestruct, Car would have to implement SelfDestruct, but it wouldn’t be public to the outside world, only accessible in Car.
There are other odd things such as when declaring a property for a class, you have to specify things on how references to a given object are handled and how it is to be handled in a threaded environment. Once you get accustomed to these nuances, Objective C behaves like most other languages you may be accustomed to…kinda.
Day 3 – Sunday
The second full day of training was more basics of Objective C with a small iOS app thrown in at the end of the day. We spent the day learning about things like blocks (aka lambdas), callbacks, collection classes (arrays, dictionaries), etc.
Probably the most important thing taught was the idea of property reference handling declarations. Objective C has what I like to call assisted memory management. It’s not as automatic as in other languages, but it’s easier to use than doing everything by hand in C. Apple uses something called Automatic Reference Counting (ARC) to keep up with how many pointers are pointing to a given object in order to know when to remove it from memory. When you declare a class variable (properties in Objective C talk), you can decorate them with various attributes that tell ARC how the reference to an instance of this object should be handled. The easiest two to explain are strong and weak pointer references. Basically, if a property is attributed with strong, it will get freed when its parent is freed. If the property is attributed with weak, it is not freed when its parent is freed. You would use weak, for example, when declaring a property with a back reference to the parent…e.g., a property called myOwner. The parent will be responsible for freeing its child, but the child won’t try and free the parent (resulting in a cycle).
Each day around 3:00 in the afternoon, we’d take a short walk (normally about 20 minutes). This was always a good time to chat with everyone and take a few minutes from class and the labs to let your mind clear a bit. HBM has several nice walking trails and is beside a small river, so the walks were always one of the highlights of each day.
Day 4 – Monday
Monday was the first full day of pure app development. We received a new instructor for the remaining of the week. The first guy (TJ) did the Objective C introduction and Michael (Mikey) Ward came on to do the iOS instruction. Mikey is the guy who wrote the BNR book for the iOS training.
We spent this day learning how views are created and handled in the iOS runtime loop. The UIs built today were pretty basic with things like buttons that show questions, and answer buttons that show the answer to the given question. In this simple example, we learned things like creating views, configuring the view objects, working with XCode’s interface builder, wiring up event callbacks for buttons, linking text labels to string properties of different classes, etc.
We also spent a little time doing some drawing on a given view. This was done drawing mostly things like circles and rectangles and other items. One of the nice things about how BNR does its training is that most chapters in its book have challenges at the end of the chapter. This means students who can “blaze” through the basic stuff can spend free time at the end of each exercise learning and tinkering with more advanced versions of whatever we learned in that chapter.
To round off the day, we discussed Scroll Views and Tab Bars. If you’ve ever used Safari on an iOS device, it is an example of a scroll view. Scroll views allow the user to navigate large amounts of content on the limited screen real estate of a phone or table. The tab bar is an easy to use iOS feature to show different screens of content when the user selects one of the tabs.
Next time, I’ll write about the fun we had for different reasons than just learning new iOS features!