Posted on Thu 28 January 2016

What I've learned about programming from two years of iOS development

I started learning iOS development a little over two years ago. During that time I've been wrapping my head around Objective-C, working on the iOS companion app for Exist, and building some smaller apps on the side. I've gone from working through tutorials a couple of hours a week to spending 20+ hours per week working on real products.

RescueTime software dev time tracked

I'm still a beginner, but I've come a long way since I started out. My progress in iOS development is one the things I'm most proud of from the past year, (see my 2015 review here) so I wanted to share some of what I've learned along the way.

Working on a project I care about makes all the difference

Before taking up Objective-C I had dabbled in Ruby and Python. I'd never gotten so far as actually building anything with either language, and had a hard time improving my skills and understanding.

When I started learning how to build iOS apps, I noticed something was different. I care a lot (too much) about iOS apps. I love looking at them, testing them, using them every day. I write about them and talk about them and think about them at night before I go to sleep.

I really wanted to build my own iOS apps. I had ideas for the apps I wanted to build. And I had a desire to learn Objective-C so I could make those ideas into real products.

When I was learning Python and Ruby, I was learning them for the sake of learning. I wanted to understand development so I could talk to developers more easily. I wanted to better understand the technical challenges of building Exist, rather than letting my co-founder, Josh, shoulder that entire burden alone.

But I didn't have a burning desire to build anything in particular. And for whatever reason, that's what it took to get me to stick with programming. Wanting to build iOS apps was enough motivation to work through the Objective-C tutorials and build practice apps.

(Now that I think about it, I learned mostly theory and syntax when I was learning Python and Ruby. With Objective-C, you're almost forced to build a bunch of practise apps so you can understand how it all works, but with Python and Ruby I was mostly learning little bits of syntax or theory in isolation. Maybe if I'd worked through lessons that taught me to build things with those languages I would have felt the same about them as I do now about Objective-C.)

Being an iOS dev beginner is not the same as being a beginner programmer

I'm a beginner at iOS development, but this is also my first ever programming language. I barely remember any of the Python or Ruby I learned, so I was essentially starting from scratch when I picked up Objective-C. This resulted in a few things:

  • I like Objective-C syntax because it's all I know. I don't know any better than to appreciate the verbosity of method names in Objective-C.
  • Almost everything new I try to understand is doubly hard because I don't understand the fundamentals of programming. Often, I don't know what I don't know—I don't realise there's fundamental theory of programming missing from my brain that would help me understand the specific Objective-C implementation I'm trying to learn to use. This is especially the case when dealing with APIs and other web technology. Not understanding the basics of web development has made my journey a lot harder, since I deal with APIs a lot in my iOS apps.
  • I learned how to do things without understanding them. Just like learning to drive a car without ever understanding how the gears and engine work, I was told how to do things in the lessons I took without being told what exactly I was doing and why. As a result, I blindly copy the same approach to some things over and over without understanding it. I also don't know when there are alternative approaches, because tutorials tend to tell you how to do something in one way, without mentioning alternatives.

Docs make more sense when you know what you're doing

I heard many developers and iOS tutors say the Apple docs were really good. When I realised I couldn't understand the docs or put them to use, I felt stupid. I didn't understand why I didn't "get" the docs, when everyone else said they were easy to use.

The more I learn, the more I get out of the docs. For a beginner, Apple docs are not very helpful. You really need to know what you're looking for, and use the docs for confirmation, syntax checking, or finding out extra details about something you already know. If you have no idea how to do something, the docs won't help you.

There are very few examples of code in the docs, so even now that I'm better at understanding them and finding what I need, I often have to resort to Google to figure out how to use the method once I know which one I need. For a beginner, this is baffling and frustrating—even more so because you're told over and over that the docs are good and that you should rely on them.

The more times I do the same things, the easier they get

It took me a long time to get okay at starting an app from scratch and just getting a view on-screen. Because my first app has also become my most complicated app, (Exist for iOS) I spend a lot of time working on new things for it. It's grown more and more complicated, and I've had to figure out things that are beyond my current skill set.

But one side effect of this is that I didn't get much practice at repeating the simplest of things: creating a new app, creating a view, making the view appear on screen, creating labels and buttons, setting up new table view controllers, etc.

For each new side project I start, I have to go through these basic steps, and I'm finally getting more comfortable with starting from scratch.

I still write bad code

I write very long methods that do a lot of things. I write horrible spaghetti code. I change properties and global variables inside methods instead of passing variables into and out of methods. I repeat code.

But at least I know my code is bad now. I'm still getting better at recognising bad code and knowing how to improve it, but I know my codebase stinks in general.

I also write complicated code that makes me feel simultaneously awesome and super confused. In Exist for iOS I've had to learn about asynchronous networking and using code blocks, writing my own helper classes, working with third-party libraries, creating custom table view cells, creating completely custom (complicated) views, downloading, parsing, and working with JSON data, working with an external API, working with local notifications, and using background fetch methods. I've also spent many, many hours chasing down bugs and wrestling with Auto Layout.

A lot of these things are common to many iOS apps, but for a beginner they can be very overwhelming. I remember when I found Cocoapods and third-party libraries so confusing that I completely avoided them. I had no idea how to understand the idea of using someone else's library (or what a library even was) in my app. These days I rely on a bunch of Cocoapods libraries in almost every app I make. But that is just a small step forward.

I have a long, long way to go as a developer. I have a lot of theory to learn about programming and how computers and the web work. I have a lot more code to write, to practise, and to understand. I have a lot of work to do to get better at designing my apps. I have lots of UX principles to learn about and understand better.

But wow. Even though there's a lot to do, it's so cool that I have come this far. I don't open Xcode to pretend I'm a developer these days. I just open it to write code. Because that's what I do. Because I know how. And because I love doing it.

I hope I have many, many years of learning, growing, and writing code to come.

P.S. I make some stuff you might like: Exist, a personal analytics app to help you understand your life, and Larder, a bookmarking app for developers.

© Belle B. Cooper. Built using Pelican. Theme by Giulio Fidente on github. .