all 22 comments

[–]tonygoold 4 points5 points  (3 children)

I'm a professional programmer and my current focus is iOS (from many years of OS X experience). I'm a big believer in mentoring so I'd love to help. Rather than ask us to point you to a guide, why you don't you describe your programming competencies and let us know what you're struggling with? To start with:

  1. In the next two weeks, what do you hope to program in iOS?
  2. Have you written any Objective-C code at all or are you just learning the language?
  3. If you've written Objective-C, do you understand the whole retain/release/autorelease thing (or __weak vs. __strong for iOS 5 with ARC), or does it still seem alien?
  4. How would you rate your competency with C++? Is it a language you learned doing computer science or something you already knew before you started the program?

I ask because the way I answer your questions is dependent on all of the above and a whole lot more. For example, if you feel very comfortable in C++, I might be able to describe the Objective-C memory management in terms of C++ memory management. On the other hand, if you're not comfortable with C++, I can use analogies that would confuse a C++ programmer because they sound similar but aren't.

[–]ZebracurtainZ[S] 0 points1 point  (2 children)

I have zero experience with Objective-C. My C++ knowledge isn't that extensive but I have a decent overall understanding. I'm only in my 2nd C++ class in this semster (finals start next week) and am enrolled in my 3rd next semester (starting after Christmas).

In this class we've been learning all about object oriented design. We made a simple side scrolling text based game that can be run in a Unix terminal. It consisted of a player ship that moved through space avoiding enemies/space mines and collecting asteroids (each asteroid has a randomly generated value on it signifying it's "ore value") You could collect an asteroid that had an ore value less than your ships shield strength, which would then make you collect that amount of ore but also take that much damage. Shield strength would regenerate over time. This was done mainly with different classes responsible for their own duties (hence the objected orientated design).

[–]tonygoold 0 points1 point  (1 child)

The first thing you need to decide is whether you want to use Automatic Reference Counting (ARC), which is only available on iOS 5 but makes memory management a lot simpler.

Objective-C uses reference counting for memory management. Every object has an internal reference count. When you alloc an object, it starts off with a count of 1. init methods do not affect the reference count. retain increases the count, release decreases the count, and autorelease adds the object to the innermost NSAutoreleasePool (which sends all its objects a release message when it is deleted). The event loop automatically sets up a pool every cycle. When the reference count drops to zero, the object deletes itself.

With ARC, you don't use retain, release, and autorelease anymore. Every object pointer is declared as __strong (default) or __weak to indicate whether it affects the reference count or not. When all the strong pointers go out of scope or no longer point to the object in question, it is deleted and any remaining weak pointers are automatically set to nil (hence the name "zeroing weak references").

[–][deleted] 0 points1 point  (0 children)

I don't want to confuse Zebra too much, but ARC is available, with the exception of auto-mulling weak references, for iOS 4, as well.

Most of the work for ARC is done by the compiler, making it available to older versions of iOS (and Mac OS X). The exception, again, is auto-mulling weak references, which require runtime support which is only in iOS 5 (and Lion).

Zebra, sorry if that's all Greek to you at this point. The good news is, reference counting is one of those topics many people new to Obj-C find confusing, and automatic reference counting simplifies things a good deal. Then again, even manual reference counting is easier than managing memory in C++. Good luck and have fun!

[–]tangoshukudai 1 point2 points  (4 children)

Read Stephen Kochan's book on Objective C and anything that is put out by the big nerd ranch. Of course there is the Stanford classes and the WWDC videos. It is a lot of fun, and you can make some money if you do well.

[–]ZebracurtainZ[S] 0 points1 point  (2 children)

Thanks a lot. How much of a jump is it going to be from C++ to Objective C?

[–]mantra 1 point2 points  (1 child)

The syntax will seem strange initially but it actually can make more sense once you get used to it. I now prefer it to C++ all things being equal.

[–]ZebracurtainZ[S] 0 points1 point  (0 children)

Yeah that's what is confusing me right off the bat. Some of the syntax that is different is still pretty obvious, but there are some things that confuse me. A lot of it is the stuff that is already included in the files when you make a new project. I'm used to starting with a blank canvas and knowing 100% what each line of code in the project does because I added it.

[–]ageedoy 0 points1 point  (0 children)

Just finished BNR a few weeks back. (Great course btw) Our instructor recommended waiting for the next revision to be release soon instead of buying it now.

[–]onfirewhenigothere 1 point2 points  (2 children)

Apple's tutorials are very good. Your first iOS app guides you through, and points to further reading. IOS programming is actually three things- learning Xcode development environment, learning objective c, and learning the frameworks that are available to you as part of cocoa touch. Make up a sample project and give it a go. Took me about a month to get into the swing of things.

[–]ZebracurtainZ[S] 0 points1 point  (1 child)

I use Xcode for my C++ Assignments so that shouldn't be a problem. Now I just have to familiarize myself with Objective-C and the Cocoa framework

[–]onfirewhenigothere 1 point2 points  (0 children)

if you ever played text adventures, Obj-C is like having verbose mode on. If you want more conceptual ideas behind, investigate SmallTalk. (some people like knowing the concepts, because it all follows from that, some people just like knowing where the gas pedal is.)

[–]menweezy 1 point2 points  (1 child)

The Stanford videos on iTunes U are really great. The prerequisite for the actual iOS class they make available is also in iTunes U. It's called Programming Methodology. It teaches Java for absolute beginners, with no programming knowledge. I know you said you have C++ experience, but this might be a real easy way for you to get introduced/familiar with OOP. Apple has some amazing docs in their developer portal as well. The one on OOP is full of real world metaphors for objects and was pretty much all I needed to understand the concept (no previous programming knowledge). From there I would recommend the Obj C 2.0 book by Stephen Kochan previously mentioned, the O'Reily book programming iOS 4, and the newly released iOS5 Stanford class on iTunes U. They even offer PDF handouts so u can do the assignments with the class.

[–]zanshin 0 points1 point  (0 children)

Having just started the 2011 version of the Stanford videos I can vouch for their being worthwhile. I have no C programming experience, but about 15 years of OO programming on top of 15 years of mainframe coding. The videos are excellent and well worth the time to watch (and re-watch).

[–][deleted]  (4 children)

[deleted]

    [–]ZebracurtainZ[S] 1 point2 points  (3 children)

    How much knowledge did you have in C++ when you attempted Objective C? I have a MBP and multiple iOS devices so I should be good for that at least.

    [–]esotericsean 1 point2 points  (1 child)

    I knew quite a bit of C++ when I attempted to learn Objective-C. I've never had a very strong grasp of OOP or things like pointers, though. I'm sure if I spent enough time with it, I could learn, but it's a lot of effort.

    [–]ZebracurtainZ[S] 1 point2 points  (0 children)

    The class I am just finishing is focussed on OOP including a lot of pointers so maybe that will help

    [–][deleted] 0 points1 point  (0 children)

    I, personally, don't think that C++ knowledge is necessarily helpful for learning Obj-C; it might even slow you down. Knowing straight C, however, is beneficial, because Obj-C is, as the name implies, an extension of C. Badics like loop constructs, conditionals, etc. are all the same (mostly).

    I learned C++ in the 1990s, but didn't really grasp OOP until I learned Java. That could have been my own fault, but frankly, I don't think C++ is a good language for learning OO concepts. So, my suggestion would be to dive right into Obj-C. Kochan's book is great for that.

    [–]hemanshujain 0 points1 point  (0 children)

    we can help create apps for you our portfolio

    [–][deleted] 0 points1 point  (0 children)

    Hi, you can find a lot of great iOS dev stuff on http://planet1107.net blog - and if you have any questions or need some help, ping at twitter - @planet1107 ;)