I started DevFright towards the end of 2012 with the aim to document what I learn when practicing to code. I started off jumping in to a book called “Objective-C for Dummies” and although the instruction was quite clear, I quickly found that I lacked some understanding of how a few of the basics worked.
I stepped back from the Dummies book and then stumbled across some Apple tutorials but quickly found them quite difficult to study. Eventually I came across some lectures on iTunes U, particularly ones about creating apps for iOS devices. Looking at the pre-requisites I found I needed to learn several things before attempting to learn Objective-C. The particular classes suggested were CS106a and CS106b from Stanford University with the former being an introduction to Java and the latter being a course on C++.
Java starts off in the world of Karel who is a robot created to help you learn the basics of programming. After a couple of lectures I had started moving Karel around his little world. Feeding him instructions such as move, turn left, pick beeper etc… I was quickly able to create some nifty programs to help him accomplish tasks such as building towers, creating a chess board and various other things. Moving on from the brief introduction of Karel I then spend the next few weeks learning about classes, objects, variables, control statements, boolean expressions, methods, graphics, event driven programming to name a few. Each assignment gets a little more complicated and allows you to start seeing the bigger picture as you move through the course.
Just like the Java course, the C++ course works in a similar way in that you build upon what you learn and step by step, walk through each of the lectures, tasks, assignments etc…
Beginning on these courses helped me gain more understanding of what objects are, what methods are and some basic understanding of how things work. The second attempt at Objective-C has been more fruitful as I can now open up XCode, create a new project, understand somewhat all the code that is on a default app and then create views, navigation as well as create some basic applications which take user input and output information back to the screen. I’ve also successfully used location and maps within an app as well as collected and displayed information from the various sensors available on the iPhone. Although I’d still need to reference the documentation a lot of the steps on creating these apps again, I still can see the bigger picture of what needs to be done and how to create them.
There’s still some way to go, but taking it step by step and building a foundation on the basic principles really helps (or at least it helped me).
Keep Writing Code!
Of course, the best way to also learn is to not just learn but actually “do”. What I mean by this is that it’s all well and good to study, read and look at someone else writing code and explaining it… it makes sense when you follow along the work someone else has done. In reality, when you sit in front of a blank canvas and have to start writing the code it suddenly becomes a lot harder. But, practise and keep practising till you understand every step of your program. An example could be an IBOutlet you create… what exactly does that mean? If you are simply copying and pasting sample code you have found, without trying to learn what you are actually doing, then you are going to struggle.
Apple documentation provides the information you need, but you also need to be able to understand how to implement what you see in the documentation. Take the UIImagePickerController Class Reference document. Do you understand what this text below means and what exactly you can do with the sourceType @property?
Or, do you understand what the difference is between a + and – class/instance method? Don’t worry if you don’t right at the beginning, but within a few weeks you’ll need to know what those mean and how you select the best option for the problem you are solving.
Keep at it, learn and practise at every opportunity and experiment with the code. The more you do this, the better you will become at solving problems. The actual code and learning what it all means is only part of the battle. You also need to know how to design the code to be more efficient, how to use the best tools and resources to accomplish a task and then how to implement all that in code.