Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Any good recomendation for references on modern syntax Objective-C has to offer these days?

Other than dot methods mentioned in the BNR book, what else is there?
 
If your end goal is learning Obj-C, learning Java first is a horrid idea. If you'd like to just learn the basics of OOP (object-oriented programing), then learning Java is still a horrid idea. Go for Python if you warn to learn OOP first. I suspect you'll be sorely disappointed with much more complicated and difficult every other programming language is after that.
 
Any good recomendation for references on modern syntax Objective-C has to offer these days?

Other than dot methods mentioned in the BNR book, what else is there?

The two main things that come to mind are block objects (blocks) and collection literals.

https://developer.apple.com/library...ollections/FoundationTypesandCollections.html

https://developer.apple.com/library...eral/conceptual/devpedia-cocoacore/Block.html

You can work your way through all of "Cocoa Core Competencies", find what you don't know, and then visit the detailed article for more info.
 
Any good recomendation for references on modern syntax Objective-C has to offer these days?

Other than dot methods mentioned in the BNR book, what else is there?

Dot syntax (for properties) is actually not that new any more.

As the other posters have said, blocks are fairly recent, and becoming central to lots of new APIs Apple has added.

Objective C version 3 also added Object literals, a way to declare objects with a very compact syntax.

Check out this link to the Clang.org website for more info:


The summary is this:

Before Objective C literals, you had to declare NSNumbers like this:


Code:
NSNumber aNumber = [NSNumber numberWithInteger: 42];
With Objective C literals, you can do the same thing by putting the number in parenthesis and preceding it with an "@"

Code:
NSNumber aNumber = @(42);


Likewise, with arrays, the old way to create and populate an array was like this:

Code:
NSArray *anArray = [NSArray arrayWithObjects: 
  @"one", 
  @"two", 
  @"three", 
  nil
];

The new syntax would look like this:

Code:
NSArray *anArray = @[
  @"one", 
  @"two", 
  @"three"
];

The old way to fetch an item from an array:

Code:
id anObject = [anArray objectAtIndex: 1];

New syntax:

Code:
id anObject = anArray[1];

The old way to replace an item in a mutable array:

Code:
[anArray replaceObjectAtIndex: 0 withObject: @"new object"];

New syntax:

Code:
anArray[0] = @"new object";

(Note that the above will crash if you try to add an item with an index that would leave missing items in the array)

Dictionaries also support new syntax. The old way:

Code:
NSDictionary *aDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
  @"value1", @"key1", 
  @"value2", @"key2", 
  @"value3", @"key3", 
  nil
];
The above syntax is counter-intuitive, since you have to provide an even number of objects, with the value before the key.

The new syntax:

Code:
NSDictionary *aDictionary = @{
  @"key1": @"value1",
  @"key2": @"value2",
  @"key3": @"value3"
};
In the new syntax you use pairs of objects separated by colons

key:value

Which is cleaner syntactically.

There is also new syntax for fetching an item from a dictionary:

The old way:

Code:
id anObject = [aDictionary objectForKey: @"key1"];
New way:

Code:
id anObject = aDictionary[@"key1"];

And new syntax for setting an object in a mutable dictionary. Old way:

Code:
[aDictionary setObject: @"new object" forKey: @"key1"];
new way:

Code:
aDictionary[@"key1"] = @"new object;

For all collections, the new syntax for initializing a collection not require a terminating nil, where the new syntax did.

Some language purists don't like these new syntax changes because when you look at code, it's hard to tell if the code is using Objective C literals or C array/structures. (The syntax is identical between NSArray indexing and C array indexing, and the dot syntax for reading/saving properties is identical to the C syntax for reading and assigning elements to C structures.

Personally, I love the new syntax. It's much cleaner and easier to type and to read. I don't mind looking at the types of the variables to tell if this is C or Objective C code.
 
Last edited:
I watched some Lynda.com videos before, they have an ObjC series, but I don't know how up to date it is. I don't think most are iOS7, but there is still value in learning the prior version, as long as they use things like ARC (Automatic Reference Counting)

Twit.TV has an offer code where you get 7 days free. Go to Twit.TV and watch the "know how" show or look around for the offer codes.

You could probably do the whole thing for free in 7 days.
 
Hi everyone,

Thanks for your replies. Sorry for the long delay in answering. I just want to say thank you for the reference links. They will come in handy in my learning process. I want to add that I do have programming experience, having developed in ASP, ASP.NET and Visual Basic, have experience in at least the basics of Ruby, Lua, Javascript, C and C++. However, like always when learning a new language, the transition is not always easy. It seems like it will take years to become competent enough to profit from the App Store (if there's really any profit to be had), and yet I see so many apps that I just wonder how others have done it, seemingly so quickly. So it is not that I am looking for shortcuts or just looking to reuse other people's code.

Still, I've learned a great deal since I first started this post, particularly about TableViews (my current area of study), so I guess that "seeming to take years" stuff might only be a feeling of mine :)

Thanks, and may the programming be with you all :)

On iTunes U, there are some amazing lecture videos from Stanford university on iPhone development. They're free and very comprehensive. They do assume that you have prior experience, we'll assume that you're true to your word :D
 
The Stanford videos are really MUCH more iOS/API based. If you're looking to learn ObjC they really aren't going to be of much use. There is some ObjC, but it's really not very entry level.
 
I'm a noobie too trying to learn how to make apps. I think I'm gonna learn mobile development the same way I learned web development. Started making websites using free tools and simple layouts back in 2003.....years later, I know all the basic concepts and can modify and make a lot of cool websites (though I'm no pro at writing scripts). Knowing the fundamentals and concepts helps a lot though even if you can't create a script from scratch.

I'm just going to take a bunch of app codes already made, reskin and modify them, study the code, learn....rinse and repeat and I'll get the hang of it eventually.

Web development and mobile development are 2 very different fields but same concept applies. Search forums, read tutorials, and just do hands-on learning. Best way to learn is by doing.
 
If your end goal is learning Obj-C, learning Java first is a horrid idea.

Should I trust the opinion of someone in this forum, or that of the Stanford University faculty? The pre-requisites for the Stanford iOS development class are CS106A and CS106B. 106A is currently taught in Java. 106B in C++. Or CS107, which is taught in C. Those are the PRE-requisites.

Why? Perhaps because there are likely several 100 well-tested university courses and textbooks on algorithms, data structures, software methodology, etc., etc. using those languages, C/C++ and Java. Versus a few short chapters in Objective C books that have had only a tiny amount of university-level testing.

There's also a lot of old/new educational material in Scheme/Python.
 
Should I trust the opinion of someone in this forum, or that of the Stanford University faculty? The pre-requisites for the Stanford iOS development class are CS106A and CS106B. 106A is currently taught in Java. 106B in C++. Or CS107, which is taught in C. Those are the PRE-requisites.

Why? Perhaps because there are likely several 100 well-tested university courses and textbooks on algorithms, data structures, software methodology, etc., etc. using those languages, C/C++ and Java. Versus a few short chapters in Objective C books that have had only a tiny amount of university-level testing.

There's also a lot of old/new educational material in Scheme/Python.

Balderdash.

How a university teaches computer science is different than how an individual learns a specific language.

If your goal is to earn a degree in computer science, you should certainly learn more than how to program iOS apps in Objective C. you need data structures, algorithms, networking, and should probably learn 2 or 3 languages, maybe more.

This thread is about learning how to program for the iOS. If your goal is to learn how to develop iOS apps, you should study Objective C, Cocoa Touch, and Xcode. If you haven't programmed before you'll also need to study algorithms and data structures, but you can do that using C and Objective C. Learning a second language is just going to fill your head with stuff that is only vaguely relevant.

Again, I'll use the human language analogy. If my goal is get a degree in Romance language studies, I will need to study several of them. Probably some Latin for background, then Spanish, French, Italian, maybe Portuguese, and maybe even the Romance language influences in English.

If my goal is to learn French, and only French, it is absurd to learn Spanish first.
 
Should I trust the opinion of someone in this forum, or that of the Stanford University faculty? The pre-requisites for the Stanford iOS development class are CS106A and CS106B. 106A is currently taught in Java. 106B in C++. Or CS107, which is taught in C. Those are the PRE-requisites.

You have to look at why those prerequisites are in place. They are there to provide an introduction to programming, not an introduction to Java. Some intro to computer science courses are taught in pseudocode. It really doesn't matter, as they are trying to establish principles. If a specific programming language is used, you would pick up the basics of that language along the way. The Objective-C course assumes an understanding of basic programming and some C syntax familiarity. You could try the big nerd ranch books. Those introduce basic programming using Objective-C with a little bit of C like practice toward the beginning.
 
Should I trust the opinion of someone in this forum, or that of the Stanford University faculty? The pre-requisites for the Stanford iOS development class are CS106A and CS106B. 106A is currently taught in Java. 106B in C++. Or CS107, which is taught in C. Those are the PRE-requisites.

Why? Perhaps because there are likely several 100 well-tested university courses and textbooks on algorithms, data structures, software methodology, etc., etc. using those languages, C/C++ and Java. Versus a few short chapters in Objective C books that have had only a tiny amount of university-level testing.

There's also a lot of old/new educational material in Scheme/Python.

Should you trust the opinion of someone who has done it or of someone who gets paid to set rules on how to do it? I'd suggest you trust the person who has actually done it. The other one may be full of crap.

Also, as a current student, I'd like to mention that I give zero thought to the pre-reqs of classes. If I want to take a class, I take it. That includes the final semester CS course, Programming Languages, which is all about inventing and implementing your own programming language, without having taken any other CS course (I'm a computer engineering major - most of my classes focus on building the various components of computers.) So far I think I made the right call as I'm learning a lot (most of it being stuff that I really wanted to learn but wasn't able to find in my department) and doing just as well as those that took the huge list of CS pre-reqs. Why? Because I'm an individual who decided to start programming 10 years ago, not a student who started when I took my first class on it 2-4 years ago.
 
Should you trust the opinion of someone who has done it or ...

Alas, many of the people who have "done it" themselves have no idea how to successfully teach a cross-section of other people (from brilliant to 49% percentile and lower) how to do it. Most have no idea how they really "did it" themselves, thus can't explain things worth beans. The ones who teach a lot of other people who can't just "do it" by themselves, how to do it, those are the teachers to trust.
 
The fact is that you CAN start with any language, however, some will tie into iOS development better than others.

For years Pascal was taught as one of the first programming languages in intro/med level programming classes. You could learn COBOL as a starting lang, but these won't lend themselves well to iOS development.

Java is not used in iOS. C,C++,ObjC are.

Part of programming includes understanding datatypes. You can learn datatypes in almost any language. Time is better spent learning datatype in an OO language vs Pascal/COBOL/...

The topic of this thread is learning quickly. Java would not be the 1st choice for that, C/C++ would be better, ObjectiveC better still, all usable in iOS development.
 
Alas, many of the people who have "done it" themselves have no idea how to successfully teach a cross-section of other people (from brilliant to 49% percentile and lower) how to do it. Most have no idea how they really "did it" themselves, thus can't explain things worth beans. The ones who teach a lot of other people who can't just "do it" by themselves, how to do it, those are the teachers to trust.

I would like to point out that at Stanford, the final destination is for you to become a programmer. Once you're a programmer, you know tons of languages, can pick up new ones like nothing, and can invent your own. Stanford's main goals do not include teaching you Obj-C - that's just an elective. Their main goals do include teaching you fundamentals of programming, and so they teach them in Java because that's one of the most common languages right now. You need to know the fundamentals - you don't need to know the language Java.

You can learn the fundamentals in Obj-C, Stanford just won't teach it that way because they need to teach everyone the fundamentals and nearly everyone Java but only a few people will want an elective involving Obj-C.
 
Also, as a current student, I'd like to mention that I give zero thought to the pre-reqs of classes. If I want to take a class, I take it.

Does your college not require you to take prerequisites in order to register for a class? Or at least take a test to prove that you have the required knowledge?
 
I would like to point out that at Stanford, the final destination is for you to become a programmer.

Exactly. There are too many people who think they can become a fluent iOS developer of full-featured native apps without becoming a programmer along the way.

You won't learn to read and write French poetry as an adult just using a Paris travel-guide phrasebook.
 
Does your college not require you to take prerequisites in order to register for a class? Or at least take a test to prove that you have the required knowledge?

Past experience would suggest that colleges vary in their enforcement of prerequisites.


Exactly. There are too many people who think they can become a fluent iOS developer of full-featured native apps without becoming a programmer along the way.

You won't learn to read and write French poetry as an adult just using a Paris travel-guide phrasebook.

The first in the sequence you mentioned merely uses Java. If it was they would go way in depth on the language itself. The course is entitled programming methodology. The second is entitled programming abstractions. Given that the full set of self-learning material for that sequence exists online, why not follow that? The iOS programming one seems to assume a knowledge of how to program. It likely assumes you understand pointers, structures, loops, and prepositional logic. It doesn't seem to be an advanced course.

As for Objective-C specifically, there are reference texts. The BNR books are typically suggested because they go over basic programming and use Objective-C as the language as opposed to a different one. You could always go back further and try the Kernighan and Richie C text. I like it, although it's out of date on a lot of points. Objective-C also reminds me more of C than it does of C++.
 
Last edited:
Over the years I've gone from Basic to Pascal to C++ to Delphi to Java to C# then to Obj-C. It was difficult even with the experience I had. Not only are you learning a new language, but a new IDE, a new OS, a new submission system, a new framework, etc.

It takes time and effort and persistence. The best way I've found to learn a language is to have a project.

Also, cookbooks are great.
 
Exactly. There are too many people who think they can become a fluent iOS developer of full-featured native apps without becoming a programmer along the way.

They didn't ask about how to become a fluent iOS developer of full-featured native apps, though. They asked how to learn Objective-C as quickly as possible.
 
Over the years I've gone from Basic to Pascal to C++ to Delphi to Java to C# then to Obj-C. It was difficult even with the experience I had. Not only are you learning a new language, but a new IDE, a new OS, a new submission system, a new framework, etc.

It takes time and effort and persistence. The best way I've found to learn a language is to have a project.

Also, cookbooks are great.

+1 ... add on all the changes as you are learning (although some/many make things easier like ARC)
 
I'm new to iOS developing too. But I know several other programming languages. I learn by do. I'm writing a forum client. My college's biggest forum has API which can be called by users. So the project I'm doing involves networking and UI stuff. It's almost been one month now, I have met a lot of problems. I learned a lot by fixing these problems. I find docs from Apple is really good. I finished Apple's Start Developing iOS App Today and Programming with Objective-C. And use books like XXX Programming Guide and iOS Human Interface Guideline as reference. Also, google helped me a lot.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.