This post originally appeared on the Crew blog.
I’ve been learning to build iOS apps in Objective-C for the past few months and I’m finally starting to really get my head around it. It’s been a lot harder and taken a lot longer than I expected.
F**k it, we'll do it live!
Our biggest ever edition of TNW Conference is fast approaching! Join 10,000 tech leaders this May in Amsterdam.
I often get stuck, get frustrated, and spend many more hours searching for bug fixes than actually writing code. But it’s an amazing feeling to play with an app on my phone and know that I built it from scratch.
I’ve learned a lot along the way—not just about developing iOS apps, but about programming in general, and even about my own learning process. I’ve also run into problems that I might have avoided if I’d taken a different approach to learning Objective-C.
Looking back at my experience here are some things I’d do differently if I was learning to code today.
Find a coding buddy
I’ve yet to find a method of learning that beats having a real person to talk to.
My co-founder Josh, who’s mostly a Python developer, has practically learned Objective-C alongside me thanks to fielding my many programming theory questions (“How does an if statement work again?”) and helping me with debugging when I’m truly stuck.
At the very least, having a patient coding buddy who can explain fundamental programming principles is a huge help. Josh will often help me think through the most logical way to approach a problem, before I work out the specifics of doing so in Objective-C.
Use every resource out there
If you’re not lucky enough to have a patient programmer around to field your questions, here are some other places to get help from real people:
Mostly useful for specific syntax or implementation questions, Stack Overflow is one of my most-visited sites these days. I haven’t asked any questions there myself yet (and I’m wary of doing so, as the community can be quite hostile to beginners) but I’ve rarely needed to—most of my questions can be solved by browsing through answers to other people’s questions.
Treehouse teaches programming through video courses and has built-in community forums where you can discuss bugs you’re having trouble with or specific exercises from the courses that you’re stuck on.
Askadev lets you connect to an experienced developer when you need help. I haven’t tried this service so I don’t know how useful it is or whether it covers all programming languages, but it’s free so you might want to try it out next time you’re stuck.
If you’re willing to fork over some cash to get help from an experienced developer, Codementor will match you up with someone who knows the language you’re learning. They cover Android, iOS, HTML, CSS, PHP, Python, and lots more.
Rubber duck problem solving
If you haven’t read it before, this post on rubber duck problem solving is really useful. The principle is this: explain your problem, out loud, to a rubber duck or other cute inanimate object, like your toaster.
The process of talking through your problem out loud will often help you realise the answer (or at least where you’re going wrong) all by yourself. I’ve found talking through my code out loud is an incredibly useful habit and I try to do it every time I get stuck before asking someone for help.
Learn the principles
One of the main things that has held me back in my time learning to code is misunderstanding or being unfamiliar with technologies I’m working with.
For instance, working with APIs means I need to understand how APIs work, how to use POST and GET requests, and how to parse JSON data. I need to know I’m going to receive JSON data, even.
Learning Objective-C isn’t all I need to know to build an iOS app—at least, not the kind I want to build. I made the mistake of thinking Objective-C was all I needed to know.
Even worse, I often get stuck because Stack Overflow answers, online tutorials, and book chapters will explain how to do something in Objective-C, completely skipping over the necessary web-based principles I need to know, because they assume that knowledge.
If I was starting over today, I would refresh and build on my knowledge of HTML and CSS first. And when I started working with something new that I didn’t know much about, I’d learn about it in general before attempting to implement it in Objective-C.
Start with any language
If you’re really not sure where to start, or what you want to build, don’t let it hold you back. Although I spent time learning Ruby and Python, and haven’t finished any projects with either of those languages yet, I don’t feel like that time was wasted.
A common starting point for beginners is to learn to build websites with HTML and CSS. These are actually markup languages so it might seem like a waste of time to start there if you actually want to build mobile or Web apps. But even in this case, you’ll gain knowledge and experience that will help you when you move on to learning a programming language.
If you’re keen to start learning to code but don’t know where to start, pick a book, tutorial, or online course that you like the look of, and go for it! You can always switch to learning a different language once you have a better idea of what you want to build.
Find a project you really care about
Probably the biggest learning curve for me has been finding the motivation to stick with my desire to learn to code. I’ve attempted it a few times in the past: learning HTML and CSS when I was a teenager, learning the basics of Ruby a couple of years ago, and learning Python more recently.
When I decided to try learning Objective-C it wasn’t because I liked the language any better than Ruby or Python, or because I knew anyone who’d already learned it, it was simply because I have a list of ideas for iOS apps I want to build—and I really want to build them.
My motivation for learning Objective-C is higher than it was for learning any other language so far because I’m motivated by personal projects I want to make.
Most importantly, when the going gets tough and I feel frustrated and stuck, I don’t give up—because I’m building a project I really care about. And every time I manage to implement something new and it turns out well, the pay-off is even better because it’s part of my passion project.
If you’re considering learning to code and you don’t have any restrictions on which language or platform you choose, I would definitely recommend choosing a project you’re really passionate about and basing your language choice on what the project requires.
Everyone learns differently, so you’ll probably have a different experience to me, but if you’re just starting out or thinking about learning to code, I hope my experiences and mistakes can help you learn even faster.
Image credit: Society of Swedish Literature in Finland