Curtis Bridges

Collecting my thoughts.

Setup for Big Nerd Ranch, Beginning iOS.  (at Historic Banning Mills Adventure and Conservation Center)
One of the bridges at Banning Mills.  (at Historic Banning Mills Adventure and Conservation Center)

Big Nerd Ranch, Beginning iOS - Day 7

Day 7 was very different from the previous days at the Ranch. It is mostly a catch-all day for miscellaneous topics that came up throughout the week as well as a discussion on tools.

I was impressed by some of the built in features of both Xcode, the debugger, and instrumentation. In particular, I was shocked by all the options available for debugging with breakpoints; conditional breakpoints, computer speach of pre-defined text triggered from breakpoints, and many other options.

Next we reviewed memory leak analysis using Instrument templates. We worked through a fairly contrived (but relevant) example where the tools correctly found an ARC leak.

The rest of the day was picking up random topics of interest. Christian demonstrated some of his techniques of debugging Auto Layout constraints with Size Classes by setting the canvas in free form mode and resizing it to see how the layout behaves. I’ve used this technique for years for correctly developing desktop applications with resizable windows so I’m very glad to see it replicated in the iOS tools. While he was at it, we saw a demonstration for constraint inequalities and how they affect animation, which led perfectly into the next topic…

Animations.

I was impressed with how easy iOS makes animating interface elements. In a lot of cases, it can simply be achieved via a call to:

UIView.animateWithDuration(\_: animations: () -> ())

with a start state before the call and the desired end state within the closure. There we variations on this as well such as Spring animations:

UIView.animateWithDuration(0.6, delay: 0.0, usingSpringWithDampening: 0.2, initialSpringVelocity: 0.0, 
    options: UIViewAnimationOptions.something, animations: { () -> Void in 
        // .. finishing code
        }, completion: nil)

And keyframe animations:

override func touchesEnded(touches: NSSet, withEvent event: UIEVent) {
    let touch = touches.anyObject() as UITouch
    let loc = touch.locationInView(view)

    // Update contraints outside of animation closure
    topConstraint.constant = loc.y

    UIView.animateWithDuration(0.5, animations: { () -> Void in
        // Re-layout views inside animation closure
        self.view.layoutIfNeeded()

        // Update view properties inside animation closure
        self.view.backgroundColor = UIColor.redColor()
    })
}

Finally, we picked up a topic covered in older editions of the book, location. I’m pleased we covered this topic, as it is something almost completely unique to the platform and something I hope to become familiar with soon (I like to jog).

Our simple example in Swift:

import CoreLocation
import MapKit
imoprt UIKit

class ViewController: UIViewController, CLLocationManagerDelegate {
    @IBOutlet weak var mapView: MKMapView!
    let locationManager = CLLocationManager()

    override func viewDidLoad() {
        super.viewDidLoad()

        locationmanager.requestWhenInUseAuthorization()

        locationManager.desiredAccuracy = kCLLocationAccuracyBest
        locationManager.distanceFilter = 10.0 // how far the user needs to move before you get updates
        locationManager.delegate = self
        locationManager.startUpdateingLocation()
    }

    func locationManager(manager: CLLOcationManager!, didUpdateLocations locations: [AnyObject]!) {
        println("\(locations)")

        // CLLocation: coordinate, altitude, horizontal and vertical accuracy
        if let currentLocation = locations.last as? CLLocation {
            // We found a location
            mapView.setCenterCoordinate(currentLocation.coordinate, animated: true)

            let span = MKCoordinateRegionMake(0.01, 0.01)
            let region = MKCoordinateRegionMake(currentLocation.coordinate, span)
            mapView.setRegion(region, animated: true)

            if currentLocation.horizontalAccuracy < 20.0 {
                manager.stopUpdatingLocation()
            }
        }
    }

    func locationManager(manager: CLLocationManager!, didFailWithError error: NSError!) {
        println("\(error)")
    }
}

And so ended my Big Nerd Ranch course. It was such an incredible experience and I highly recommed anyone interested in one of the course topics taught by Big Nerd Ranch to give them serious consideration; the environment is completely unique and they certainly aren’t lying when they say it is “monastic like”. The lack of external distractions of the real world certainly went a long way in helping become emersed in the material.

I hope to put it to good use soon.

Big Nerd Ranch, Beginning iOS - Day 6

Day 6 has come and gone and the amount of code and hours involved with this training is starting to take its toll on the level of energy. That said, the day starts off with some really interesting topics that help invigorate me personally. Storyboards are something that Apple appears to be pushing more of late and I think are the most efficient future of iOS UI development.

Like the smaller level user interface elements such as views, buttons, and labels — Storyboards’ interactions feel natural in Interface Builder. Placing constraints isn’t bad but adjusting them or handling different size classes feels is awkward. Hopefully, these workflows can be refined over time.

We also covered connecting to web services, which is incredibly useful in today’s cloud-based world, particularly in the mobile. It was good to learn how iOS and Swift handles web requests and JSON parsing if not exactly fun coding.

One of the unique experiences offered on this trip is zip lining at Banning Mills. A few of us signed up for the one slot set aside for it this week and had a blast. I can admit to having some shaking knees while standing at the top of the launch towers but zipping down the steel cables felt surprisingly relaxing. This is such a great experience, I hope everyone takes this opportunity if given the chance.

Lastly, we covered touch events and ended gesture recognizers. I really like how these features are implemented, very concise and elegant. We built a gesture-based primitive drawing app around these concepts and it was quite satisfying.

The Patriots played a Thursday night game, which many of us gathered around the TV in the main lodge area to chat, have a beverage, and take a night off from coding. The game finished on the final play — a blocked field goal so it was a late night for me. Probably not a great idea given the level of tiredness I was already experiencing.

It is all worth it.

Big Nerd Ranch, Beginning iOS - Day 5

Day 5 continued, once again, where the previous day left off — which is to say, more user interface topics.

We dove right in to Auto Layout, using contraints to dynamically control the layout of our user interface elements on the screen. Along the way, Christian showed us some common mistakes and the corresponding errors displayed in Interface Builder or the app console and how to fix them. It is amazing to me how much more polished an app looks when it behaves and looks correct on different devices and orientations.

We then explored how to do Auto Layout programmatically. I didn’t even think this was possible. I’m not sure I’ll want to attempt it in very many situations but I’m sure there will be times when it is potentially necessary. Time will tell.

Once we moved on from the basics of Auto Layout, we moved into Size Classes which allow you to dynamically change the layout of your app dramatically based upon the size of the platform it is running. It is a mobile developer’s version of responsive design. It makes a huge difference in the usability of an app to efficiently use the space available to it on each platform and orientation.

The complexity of both Auto Layout and Size Classes will require lots of post-class experimentation to truly feel comfortable with, but for now, I understand the basics.

In the afternoon, we went for our usual walk but it turned into a mini-adventure. We walked down the river to the old Banning Mill, which happened to be on the other side of the river. Since we were there, a few of us crossed the river via some exposed rocks which quickly turned into the entire class. Christian said he had only had one other student in passed classes cross and yet there were seven of us that did on this trip. There was some rough terrain coming back but it was fun and good exercise. I think a few people got more than they had bargained for.

Finally for Day 5, we moved on to Core Data. For the first time in the class, I was relatively uninterested in a topic. I recognize the power of the technology but for my immediate purposes, I’d rather explore other topics. I decided to take my first break on this chapter. Every chapter prior to this one, not only did I do the core example, I had done all the suggested challenges. Some chapters, I had even added some of my own user interface touches to the app but this chapter was a good time to take a short break.

Tomorrow should be another good day — storyboards, web services, gestures, and more.

Big Nerd Ranch, Beginning iOS - Day 4

Coming off yeserday’s high, I was very much looking forward to today.

Today started an entirely new project, a home inventory app. This app is designed with a table view, a control used constantly in iOS apps and within iOS itself. Given its widespread use, this is an important day of hands-on training.

I found the control to be interesting but not entirely what I was expecting; I’ve used a lot of table controls in prior UI implementation, but it is a little different on iOS. Most tables have a variable amount of columns as well as rows on other platforms — on iOS it appears that tables have a single column and rows themselves are designed around a single control of your design. This design can include “column-like” structures but aren’t required to look like columns. This makes UITableView something entirely different to me. It certainly allows for some rich display of items but isn’t exactly like a traditional spreadsheet design.

Another interesting aspect of UITableView are the other parts of the control — headers, footers, and even a notion of sections. Christian (the instructor) pointed out how iOS’s Settings app uses sections. This certainly makes for some different takes on the design of an application.

We then learned some CRUD (Create, Read, Update, Delete) operations on tables. iOS does some interesting things when it comes to efficiency of UI display by reusing cells when it can. The rest was pretty typical stuff.

Next, we added a navigation control to our design. This control is fundamental to mobile app design, as it allows a hierarchy of views to be navigated and have a standard “back” button to return from “drill down” views. The drill-down view for our table view of inventory items was a detailed view of an item. This showed name, serial number, value and date created. To this view, we eventually added a toolbar that linked to the camera app using the system’s camera button and eventually made it also allow editing of the photo selected. This detailed item view then displayed the selected photo.

Lastly, we tied the app into system events so our inventory could be persisted to disk. At this point, you have a reasonable app’s functionality. Tomorrow will involve Auto Layout to clean up some of the visual aspects of the app to add a signifigant amount of polish.

This has been a great experience so far and I truly feel like we’ve gained a a broad spectrum of the core of iOS development already.

Big Nerd Ranch, Beginning iOS - Day 3

Day 3 is a key day for this course: this is when we first get into the frameworks and APIs that allow us to actually program for iOS.

I was not disappointed.

We immediately dove right in and created a new iOS app project. To start, it was just a simple quiz design, with two labels and two buttons; hitting the question button would display one of the preloaded questions on the question label and hitting the answer button displays the corresponding answer on the answer label. Simple, but effective in learning some of the basics of the tools and two basic ui controls.

Once the introduction project was completed, we moved on to creating our own custom control that drew its own visualization on the screen using lower level drawing functions. This is a good project because you can immediately see possibilities on how this could be used in our own projects in the future. This project finished with a challenge to place an image on the screen which added a bit of polish.

This project continued in the next chapter, and taught us how to handle scrolling, zooming, and paging. All necessary concepts in UI development.

Next, we added a tab bar controller — a very common view controller in iOS applications. Looking at the results, you can finally see that you’ve learned some of the basics of iOS programming at this point. This is a great feeling to end Day 3.

I’m very much looking forward to tomorrow.

Big Nerd Ranch, Beginning iOS - Day 2

The second day of courses really expands upon the basics learned in the pre-reading and day 1 content. It mostly is centered around the object oriented parts of the language such as structs and classes, their properties and initializers, protocols (interfaces) and generics. Swift also adds the concept of extensions and carries forward Apple’s Objective-C automatic reference counting (ARC).

Many of these concepts are liberally borrowed from aother languages and environments but have their own Swift spin on the concept. I haven’t used a concept of extensions before, and it is both awesome and scary. Extensions allow you to do what its name implies: extend existing constructs to add functionality; this isn’t inheretence, it is more like genetically altering nature globally. Like I said; great… and scary.

After a twelve hour day, my brain is fried but there’s a smile on my face.

As I said yesterday, I’m taking notes on the slides and instruction being presented each day. I’m using two tools for notetaking this week: TextMate and Marked 2. I chose to write in Markdown for several reasons:

  1. I needed to learn Markdown since it is so widely used.
  2. I wanted my notes easily searchable through as many means as possible. (grep, Spotlight… everything)
  3. I wanted to evaluate some of the associated tools such as Marked 2

Xcode has had some rough edges during the development process, which is not surprising given the rapid rate of development and features added recently. Most of the (admittedly minor) issues involved a few warts with Playgrounds but nothing that couldn’t be coded around.

I’m really enjoying the content and the instructors. This is exactly the experience I was hoping for.

Big Nerd Ranch, Beginning iOS - Day 1

Day 1 picks up after the pre-reading with more basic programming language constructs common to other languages. Arrays, dictionaries, functions, and enumerations. In addition, Swift adds a few more concepts that I have not used professionally yet — Ooptionals and closures.

The instructors at Big Nerd Ranch really encourage you to type out all the example code in the chapter as it helps reinforce the concepts being introduced. I’m taking the approach that if typing the examples is good then typing the example code and the slides should be better. Hopefully RSI doesn’t creep in by the end of the week…

We spend the day getting short lectures to introduce a chapter in the unreleased Big Nerd Ranch Swift book, follow by reading the chapter just introduced, and working the examples. At the end of each chapter is typically 1-3 coding challenges to extend the examples in the chapter. Since you can get by simply typing in the example code verbatim, I really like that the challenges don’t provide a solution; you’re on your own, just like the “real world”.

I believe I have a good grasp on most of today’s instruction, although the finer points of closures will warrant some deeper exploration to truly grasp to their fullest.

After a 10 hour day of mostly coding, reading, and instruction… I’m exhausted. But loving every minute of it.

Big Nerd Ranch, Beginning iOS - Day 0

This week, I’ll be participating in an offsite training program developed by Big Nerd Ranch outside of Atlanta, Georgia. I’m very much looking forward to some dedicated learning and programming time since it is so hard to come by in my typical day-to-day life. I’ll be basking in the glory of 7 days of classroom learning, programming labs, and projects.

The course is centered around learning the iOS frameworks, Xcode, and the Apple development process. We received a good surprise shortly before leaving this week — we’ll be the first public offering of this course using the Swift programming language. I’m not sure I could have planned this any better, we’ll be as fluent in Swift as anybody outside of Apple employees and established iOS developers on the cutting edge.

The pre-reading involved the first eight chapters of the unreleased Swift book, which covered the basics of any language: types, control structures, and looping. Information provided by Big Nerd Ranch also requested we bring provisioned iOS devices, which I verified by deploying an empty Swift project to my iPhone 6.

Travel to Atlanta was uneventful, I had a pleasant flight down where I just happened to be seated with my daughter’s pediatrician. I spent a few hours in Atlanta’s airport waiting for the first shuttle time and was surprised how far outside of Atlanta the Big Nerd Ranch site was — a 45 minute ride.

Historic Banning Mills is a nice, rustic atmosphere. I’m not sure my wife would like how rustic it really is but it is a good setting for classroom learning, lacking the disctractions of daily life. There are some of the basic ammenities of a retreat such as massages, and facials but none of that is for me. What is very interesting is the advent of zip lines. They market them as Guinness World Record zip lines and I hope to use them at some point this week.

We settled in our classroom and then had a good dinner. I can’t wait to get started!

ted:

asylum-art:

Undulatus asperatus: Storm Chaser Captures Mesmerizing Time-Lapse of Clouds Rolling Like Ocean Waves
“Undulatus asperatus” is a cloud formation proposed in 2009 that roughly translates to “roughened or agitated waves.” These dark and stormy clouds travel across the sky in ominous waves, but generally dissipate without an a storm forming.
Storm chaser Alex Schueth was recently in the right place at the right time with his DSLR, and managed to capture one of these formations in the mesmerizing time-lapse video seen above. Watch the video:

via (PetaPixel)

Clouds are awesome. You know who loves clouds? Gavin Pretor-Pinney, founder of the Cloud Appreciation Society. 
Watch his talk for gorgeous photos of nature’s finest aerial architecture»

Amazing.

ted:

asylum-art:

Undulatus asperatus: Storm Chaser Captures Mesmerizing Time-Lapse of Clouds Rolling Like Ocean Waves

Undulatus asperatus” is a cloud formation proposed in 2009 that roughly translates to “roughened or agitated waves.” These dark and stormy clouds travel across the sky in ominous waves, but generally dissipate without an a storm forming.

Storm chaser Alex Schueth was recently in the right place at the right time with his DSLR, and managed to capture one of these formations in the mesmerizing time-lapse video seen above.

Watch the video:

via (PetaPixel)

Clouds are awesome. You know who loves clouds? Gavin Pretor-Pinney, founder of the Cloud Appreciation Society. 

Watch his talk for gorgeous photos of nature’s finest aerial architecture»

Amazing.

Top 10 Reasons Why The BMI Is Bogus

muddybadger:

1. The person who dreamed up the BMI said explicitly that it could not and should not be used to indicate the level of fatness in an individual.

2. It is scientifically nonsensical.

3. It is physiologically wrong.

4. It gets the logic wrong.

5. It’s bad statistics.

6. It is lying by scientific authority.

7. It suggests there are distinct categories of underweight, ideal, overweight and obese, with sharp boundaries that hinge on a decimal place.

4.5 minutes to listen and 30 seconds to read.  Why BMI sucks and people need to stop using it.

I’ve always said this. Such a horrible metric.

The Church of GTFO

A good perspective on all tech.

An interview with Jonathan Mann

This is a good series of interviews, and I like Jonathan’s take on gear. I often suffer from the mindset that I don’t have the right ‘stuff’ to accomplish a task when I should really just get creating and worry about specific tools after achieving actual goals.

I’m also in awe at his body of work, persistence, and sense of humor.

This is worth checking out.