iOS: Getting to Know Objective-C

Moving into Chapter 2, “Objective-C”. At this point, I’m prepared to be lost, but I try to keep up. It goes into discussion of Objects, Instances, Methods, etc. The book is clearly trying to keep things short, but I need visual representation of these things. A table or graph showing what these things are, how often they’re used, what they do, etc. in a sentence or less would be helpful. Someone should get on that.

I try to create visual representations in my head:

Objects = a box with something in it that does something with focus, like a toaster or hair dryer.
Class = the box’s distribution center.
Instances = The mayfly of objects, living only long enough to reproduce or eat and then it dies.

But, things start to get a little fuzzy as we move into phrases like NSMutableArray. What does “NS” stand for? Why is it “mutable”? Is it because it makes a lot of noise? Is that short for “mutate-able”, meaning it can change and evolve?

For example, here’s some sample code it gives us in the book:

[arrayInstance replaceObjectsInRange:aRange

I know a few things about this, namely that the colons always line up for the sake of readability and that we’re dealing with an array. This one’s not so difficult, but sometimes when texts give sample code I have a hard time discerning what’s junk filler text and what’s not. I assume “arrayInstance” and “replaceObjectsinRange” are reserved commands that actually do something. I assume “aRange” and “anotherArray” are the filler examples, but if not for those in context, I’d be inclined to think that “anotherRange” was a reserved phrase. It might be more helpful if it were like this instead:

[arrayInstance replaceObjectsInRange:LoremRange

Italicizing and including Lipsum text makes sense to me since it feels more conventional. However, does “withOjectsFromArray” do something, or is it more like “withObjectsFromLipsumArray”? I don’t know.

The book charges on, somewhat without me. I can keep re-reading until I’m blue in the face, but it’s not going to help. I need tangible, visual things to straighten me out. It goes on to telling us to creating a new command line utility, which I correctly assumed meant it only worked in Terminal.

As it walks us through creating classes, discerning .h from .m files, etc., I inadvertently make a mistake while we build this “Possessions” app. You see, they’re only four words in the English language that I use with some regularity that I can’t spell. And I’m a good speller, too. Those words in no particular order are:

  1. Refridgerator
  2. Doughnut (or is it “Donut”? No one knows.)
  3. Albaquerque (I at least remember that it ends with two “que”s)
  4. Posessions

Guess how many times I misspelled “Possessions” in XCode with just one of the first “s’s”? A lot. The thing never worked from the get-go because I assume I was typing while looking at the book just enough that I did put the other “s” in there some of the time. By the time I had written dozens of lines of code, it was a mess.

I thought, “No big deal. This is what Find and Replace is for.” No. Not really. It worked, but couldn’t discern capitalization well and I wasn’t in the mood to sit and run through each line of code. In my haste, something went screwy and when I tried to give up and copy/paste from the source files that came with the book, it got even worse. I couldn’t even cheat effectively. XCode lit up like an angry red Christmas tree with error after error.

Eventually, after copying and pasting every last file, I isolated the problem to one area: everywhere.

Then the app started working and I was left frustrated and feeling lousy without any real posessions.

Want to know when stuff like this is published?
Sign up for my email list.

Photo of Justin Harter


Justin has been around the Internet long enough to remember when people started saying “content is king”.

He has worked for some of Indiana’s largest companies, state government, taught college-level courses, and about 1.1M people see his work every year.

You’ll probably see him around Indianapolis on a bicycle.

Leave a Comment