Resolved Beginner to Xcode - Why is it so hard?

Discussion in 'iOS Programming' started by lasash, Sep 15, 2012.

  1. lasash, Sep 15, 2012
    Last edited: Sep 26, 2012

    macrumors member

    Joined:
    Sep 15, 2012
    #1
    Hello,

    I started learning Xcode with the Big Nerd Ranch Guide 3rd edition, which I ordered from Amazon.
    It had very good reviews.

    I come from the background of web development: php, ajax, mysql, js etc.
    I'm already 1/5 of my way in the book (it has 569 pages) and jesus, it is quite hard!

    I can handle the objective c syntax, as I learned c in high school, but I can't figure out where do all the methods, function, delegations and stuff come from.

    It's like there are million of functions and nothing is really systematic.
    What's with the + and - before functions, and with the stretching lines thingy?

    Should I give up or should I continue until I finish the book?

    I know a guy who did a course of an year in a professional school, and I don't think he knows any other programming languages.

    I really, really want to learn how to develop for iPhone.
    What should I do?

    Thanks for reading,
    Liroy
     
  2. macrumors member

    Joined:
    Apr 20, 2012
    #2
    I learned by typing out notes, lots and lots of notes with short cookbook examples. Taking the time to write things out cleanly helps you learn it. And reading through the notes helps you retain them (pun intended).

    I found the fastest way to code is to search my notes, then a Google search if needed.
    http://stackoverflow.com/ is my favorite site for short code.

    http://www.raywenderlich.com/ is my new favorite for tutorials
    You already have the best book for beginners.

    The good part about the difficult learning curve is that it reduces job competition and helps salaries once you're "in the club." Keep your chin up, and don't worry.

    Here's my notes on the +/- methods as an example:


    Code:
      Instance Methods
      	Preceded with "-"
    
    	Declaring:
    		- (FMResultSet *)executeQuery:(NSString *)sql 
    			withParameterDictionary:(NSDictionary *)arguments 
    
      	Calling a method:
      		[yourCar getGas];
      		[self getGas];
    		currentMileage = [yourCar odometer];
    		[yourCar setSpeed: 55];  //calling with argument
    
        	Multiple arguments get interleaved with names
    		[myFraction setTo: 1 over: 3];
    		-(void) setTo: (int) n over: (int) d 
    		{
    			numerator = n;
    			denominator = d;
    		}	
     	Can omit argument names, but not recommended	
    		[aFraction set: 1 : 3];
    		-(int) set: (int) n: (int) d;
    
    	Example:
    		@implementation ViewController
    
    		- (void)viewDidLoad
    		{
    		    [super viewDidLoad];
    			// Do any additional setup after loading the view, typically from a nib.
    		}
    
      Class Methods
    	Preceded with "+"
            Obj-C's version of a Static method that is per class and not per instance, only one around.
    	
    	Benefits
    	  1.  Can produce results without having to instantiate an object
    		Good for convenience (debug) methods
    		Another approach is a simple C function declared in header files
    	  2.  Can be used to pull a singleton's reference from anywhere
    		Many singletons in IOS
    	  3.  Ties into the IOS memory management scheme 
    		[NSArray array] class method that returns autoreleased initialized array
    		
     
  3. macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #3
    It sounds like you're having problems with the concepts of object-oriented programming as well as being overwhelmed with the richness and complexity of the Cocoa Touch frameworks.

    iOS is a big, complex OS. There's a lot to learn. Don't be discouraged, though. After struggling with it for a while it will start to make sense.
     
  4. macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #4
    First off, I doubt it's Xcode you're finding difficult. Xcode is an IDE. The things you've described weren't difficulties with its features, like the interface builder or debugger tools, but with the Obj-C language and Cocoa Touch Frameworks.

    solderguy1 already gave a good explanation of the +/- that prefix methods.

    I'd like to mention that you should probably have a goal in mind other than "learning" Cocoa Touch. You're going to be overwhelmed. I'd say focus on specific goals instead. Think of something you'd like to do in your app, and then figure out which classes and methods will help you do it. IDK, that's the way I learn at this point.

    Maybe you should look at the iOS development classes offered by Stanford for free via iTunes U. They'll give you a great introduction to some of the essential classes and methods of the Cocoa Touch frameworks.
     
  5. macrumors 68000

    Joined:
    Sep 8, 2006
    #5
    You mentioned that you know PHP. I started PHP a few months ago and noticed that you could write in this language 2 ways. Procedurally like in C, or object oriented. I am guessing that you use PHP procedurally like I am using it.

    I have the Big Nerd Ranch Guide but If I would have learned from this book I would have failed. Learning Objective C and Cocoa at the same time would have been over kill for my brain.

    I started with Stephen Kochan Programming in Objective C which was a struggle too. I ended up buying the videos to better help illustrate what was going on. As a side note this was my first programming book and I failed. I stepped back to learn C and only then was I able to step back into this Object C book.
     
  6. macrumors 68000

    thewitt

    Joined:
    Sep 13, 2011
    #6
    Go thru the Stanford podcasts. They are very good. We make them a requirement for all new hires.

    Do the exercises. Don't just read them...
     
  7. thread starter macrumors member

    Joined:
    Sep 15, 2012
    #7
    Thank YOU!

    Hi solderguy1,

    Thank you so much for your reply.
    I know stackoverflow.com, it's the because resource for php/jquery problems I have. I didn't know the 2nd website, but it was added to my bookmarks.

    You're right about the job competition, I just will I'll be able to get into "the club";

    Thanks a lot for your - + notes, now it's clearer to me!

    Cheers,
    Liroy



    ----------

    Hi Duncan

    I know oop well, it's the syntax that is hard for me. I'm used to dots and -> in php, not [ ] etc.

    The Cocoa Touch frameworks is quite difficult, and yes, I am highly overwhelmed with all the options and functions. I get lost in it...

    Thank you for your encouragement! I will try harder to learn it. I've put a task for myself to finish one chapter per day in the book.

    Thanks again!

    ----------

    You're right, Xcode is easy. It's the Obj C and the Cocoa Touch frameworks I find hard to manage. I saw the Stanford classes in the iTunes U, is it really a recorded webcast that you can learn from?

    Thanks again for your comment, it encourages me to keep struggling.

    ----------

    PHP is like speaking English for me, I see the logic and the concept in it, and I just swim in it - but obj c is the opposite. Every time I think I understand what's going on, I see a new method or a new framework, and I have no idea what I'm doing...

    I would see the podcasts in the iTunes U of Stanford, hopefully it will help me to illustrate what's going on.

    But yeah, I felt like my brain is being overkilled...

    ----------

    Will do. I had no clue about the iTunes U app and the Stanford podcasts... Thanks!
     
  8. macrumors 6502a

    Tander

    Joined:
    Oct 21, 2011
    Location:
    Johannesburg, South Africa
    #8
    Hi lasash,

    Like you, I am wanting to get into development for iOS. I've been doing it on and off for a few months. However since I have a 9 to 5 job, it's difficult for me to get time to study and focus on what I need to complete.

    I'm reading the Big nerd Ranch: Objective-C programming. It has not gotten into anything else yet, beside the Object-C syntax. I find the book very helpful.

    I tried the Standford videos and that was just way too much information in one go for me. So, I decided to learn the syntax first, then move over to knowing the MVC's and the rest of it.

    What I do at the moment, I copy the code from the book examples - but I leave loads of comments everywhere. Then I remove all the code and use my comments to help me rebuild the program.

    I find this helps me understand it a lot more, when I am actually thinking about what I need to type and what code I need to get it to work.

    I do refer back to the book if I get stuck - but the process still helps a lot.

    Good luck!
     
  9. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #9
    Which Big Nerd Ranch Guide would that be? I'm guessing "iOS Programming: The Big Nerd Ranch Guide (3rd Edition)" by Joe Conway and Aaron Hillegass. When referring to resources such as this, this forum asks that you please provide exact title, author(s), edition (and chapter and page number, if necessary). Thanks.
     
  10. thread starter macrumors member

    Joined:
    Sep 15, 2012
    #10
    Hi, It's my first time here and I didn't know - sorry.

    ----------

    Hi there

    I watched Stanford's first lesson, and it was helpful, but too much - I lost concentration lots of time, as much as I would do if I was in that class.

    I'm not the code notes guy, but I do understand what's going on now after watching Stanford's lesson #1, and it's all about understanding that [] are actually obj.property or obj.method(), to which I'm used to from js programming.

    I too have a 9 to 5 job (more like 11 to 7), but I made a commitment to myself that I would try and finish one chapter a day. That way I could repeat if necessary and start getting into programming.

    I wish you success!
     
  11. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #11
    Actually, it's the reverse. The dot-notation is just syntactic-sugar that was added as part of Objective-C 2.0 and actually gets translated to use the []. And there are plenty of cases where you must use [] because there is no dot-notation equivalent.
     
  12. macrumors 65816

    pulsewidth947

    Joined:
    Jan 25, 2005
    Location:
    squarefrog.co.uk
    #12
    Stick with it, it gets much easier. One of the best things for me was people forcing me to look up stuff in the Developer References. Initially I was overwhelmed as there may words I didn't understand.

    Now its one of the first place I look to jog my memory. I wrote my first, very basic app a couple of years ago. And over the past year I've done more and more coding and I love it.

    I still get stuck over silly things sometimes, but every day helps!

    Conversely, I looked at some PHP the other day and had no idea what was going on :)

    What may help is the new array/dictionary syntax. For example:
    Code:
    NSArray *fruits = @[@"banana", @"apple", @"pear"];
        NSDictionary *people = @{@"name" : @"Paul", @"location": @"UK"};
    
    
    There are lots of neat things like that. The difference between
    +(void)classMethod;
    -(void)instanceMethod;

    Will suddenly make a lot of sense.

    Anyway I'm rambling and probably not very helpful, but don't give up!
     
  13. macrumors 65816

    TouchMint.com

    Joined:
    May 25, 2012
    Location:
    Phoenix
    #13
    I think the very best thing you can do is take the examples in books and start writing your own stuff in them. Another thing you can do is try to recreate some programs you have written in other languages. Honestly the best thing for me was writing real programs. Reading books gave me an OK base but I didn’t really understand much until I started writing real programs no matter how small just seeing them work really helped.
     
  14. macrumors 6502a

    Tander

    Joined:
    Oct 21, 2011
    Location:
    Johannesburg, South Africa
    #14
    I agree with this too.

    As I am going to the later chapters of my book, where I am writing programs that do more - I am enjoying it more. I also make my own program based on that chapters lessons. I find this helps a lot.

    Also i agree, it gets easier as you go along - I find I understand things a lot more as I progress.
     
  15. thread starter macrumors member

    Joined:
    Sep 15, 2012
    #15
    I actually like this syntactic-sugar thing, it makes the code much more organized in my opinion, and it gives good hierarchy to things.

    this:
    parent.obj.value

    is more understandable to me than this:
    [[obj_type obj] value]
    or something like that

    ----------

    I continued reading and got into the chapter of the UITableView, and I think this is where things start to get interesting and useful. Only now do I realize that writing iPhone and iPad apps takes a lot of programming and knowledge.

    I now admire the iOS programmers even more... and wish to become one myself someday (soon, I hope).

    ----------

    I wish at the moment I could write real apps, but I still learn the basics.
    It's a world with millions upon millions of possibilities, and I often find myself get lost in between...

    I can't wait to write my first basic app!

    ----------

    Same here, it was very hard at the first chapters, with all the command line stuff, but now I kind of understand what's happening. I can relate to the syntax, but it's still very confusing, all the MVC ideology...
     
  16. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #16
    You might be interested, then, to read this rather strong, opposite opinion from Joe Conway of the Big Nerd Ranch.
     
  17. thread starter macrumors member

    Joined:
    Sep 15, 2012
    #17
    Hey
    Just read it and now I understand that the dot writing is inconsistent and buggy. I would prefer to use the brackets as everything is explained there.

    I even started to watch tutorials on YouTube and everybody's using the brackets.

    Thanks for that interesting blog post!
     
  18. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #18
    Well, then you might be interested to read a blog post with a rebuttal (of sorts) which also links to some other opinions on the matter from people of note. See the last paragraph for the goods.
     
  19. macrumors member

    Joined:
    Jan 19, 2009
    Location:
    NJ
    #19
    For what it's worth, I'd recommend checking out Lynda.com. They have some great video tutorials and example files which help you get up and running on your own. They also have a 2012 introduction to iOS SDK, an Intro Objective-C course, and many other helpful courses!
     
  20. thread starter macrumors member

    Joined:
    Sep 15, 2012
    #20
    That's interesting, but I still agree with Joe from BNR, that if Apple is auto-completing the code with square brackets, why not taking the easy path and learning something new?

    I'm sure it has lots of sense, and even I, after a few weeks of hardcore studying the book (I opened this discussion when I was at chapter 6, now I'm at chapter 26), I learned the brackets ideology.

    Thanks for the links, dejo

    ----------

    Hey, thanks!

    I might be using this after I finish with the current book (Big nerd ranch 3rd edition iOS development).

    I also saw the iTunes U Stanford classes, but in the first class I kinda' fell asleep, even while I wasn't physically in class...
     
  21. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #21
    Xcode will also do code-completion with declared properties.
     
  22. thread starter macrumors member

    Joined:
    Sep 15, 2012
    #22
    Yep, I am very much fund of this, coming from PHP where I have to write all in Notepad++ :)
     

Share This Page