Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

JPGR_Fan

macrumors regular
Apr 5, 2003
188
29
St. Louis
Thanks for the feedback. That chapter has remained unchanged for five years (since the first edition) and I've had many readers write and tell me how that chapter in particular helped to clearly explain the concepts of OOP to them. I'd appreciate an email indicating what it was that you found difficult to understand.

Cheers,

Steve Kochan

I have this belief about my learning style that if accessible, I will consult multiple versions of the same topic, so I was quick to jump elsewhere when I felt Chapter 3 hadn't sunk in like how to sync an iPod.

I'm blown away by your willingness to help your readers, and hope you are still available when I have substantial questions in the future.
 

firewood

macrumors G3
Jul 29, 2003
8,141
1,384
Silicon Valley
Thanks for the feedback. That chapter has remained unchanged for five years (since the first edition) and I've had many readers write and tell me how that chapter in particular helped to clearly explain the concepts of OOP to them. I'd appreciate an email indicating what it was that you found difficult to understand.

I may be an old curmudgeon, but I've always thought that structured programming and OOP concepts should be taught after students know enough basic programming to get themselves into trouble without these more advanced concepts. OOP and structure were either invented or became popular to solve problems in software methodology. Teaching these concepts too early leaves students dazed over virtues that they have little comprehension of without having sufficiently encountering these problems or at least studying the history of these problems and why they need to be solved.

I, unlike Wirth, believe it is a virtue to cause a little brain damage by teaching simple assembly languages (and their HLL "equivalents") first, because it progresses students more along the history of the technology.
 

GoKyu

macrumors 65816
Feb 15, 2007
1,169
24
New Orleans
I also made it to chapter 3 - the beginning was great, I really loved the car analogy for the class, method, etc.

I was ok until I hit Program 3.2 with the @interface, @implementation and all these -(void) commands that I'm not at all understanding.

I did have a basic question on exercise 2 at the end of chapter 2 (page 25) if you could give a quick answer...

Rather than write out 4 whole NSLog (@".........."); commands, I thought I could do everything in one command this way:

NSLog (@"Line one text \n
Line two text \n
Line three text \n
Line four text");

But it wouldn't compile spanning lines like that. It *did* work if I put everything on one line, but then it's tougher to read.

Do you have to put a ; after each line? I would think being in the middle of a (for lack of a better term) "print" command, the ; character would just be printed, rather than be seen as "end of line" character.

It's gonna be tougher going than I thought, but I'm willing to give it a try :)

-Bryan
 

XnavxeMiyyep

macrumors 65816
Mar 27, 2003
1,131
4
Washington
I also made it to chapter 3 - the beginning was great, I really loved the car analogy for the class, method, etc.

I was ok until I hit Program 3.2 with the @interface, @implementation and all these -(void) commands that I'm not at all understanding.

I did have a basic question on exercise 2 at the end of chapter 2 (page 25) if you could give a quick answer...

Rather than write out 4 whole NSLog (@".........."); commands, I thought I could do everything in one command this way:

NSLog (@"Line one text \n
Line two text \n
Line three text \n
Line four text");

But it wouldn't compile spanning lines like that. It *did* work if I put everything on one line, but then it's tougher to read.

Do you have to put a ; after each line? I would think being in the middle of a (for lack of a better term) "print" command, the ; character would just be printed, rather than be seen as "end of line" character.

It's gonna be tougher going than I thought, but I'm willing to give it a try :)

-Bryan

You don't watt a semicolon after each line, because that's a terminal character, which doesn't apply in the context of this string.

You want to put a \ after each line, so it will recognize the whitespace.

NSLog("@LOL\n\
LOL\n\
LOL");
 

GoKyu

macrumors 65816
Feb 15, 2007
1,169
24
New Orleans
You don't watt a semicolon after each line, because that's a terminal character, which doesn't apply in the context of this string.

You want to put a \ after each line, so it will recognize the whitespace.

NSLog("@LOL\n\
LOL\n\
LOL");

That's awesome, it compiles perfectly now, thanks :D

-Bryan
 

Josh Kahane

macrumors 6502
Original poster
Aug 29, 2006
439
1
Suffolk, UK
Does anyone know of any resource that will help me understand whats in chapter 3 please? So then once i understand it better I can move on in the book.
 

Zombie Acorn

macrumors 65816
Feb 2, 2009
1,307
9,132
Toronto, Ontario
Does anyone know of any resource that will help me understand whats in chapter 3 please? So then once i understand it better I can move on in the book.

I actually just picked this book up too, and just got to chapter 3. I have done a little bit of programming before and the class/object/method is pretty confusing sometimes. What you are basically trying to do is create a representation of how we group things in real life.

When you see a cat you know that its a cat because it has the attributes of the class cat. It meows, purrs, scratches etc (these are its methods). Each cat is part of the class cat, but every cat is its own individual self or instance (object).

I don't know if that helps any, but im sure someone else will come along with something better.
 

Josh Kahane

macrumors 6502
Original poster
Aug 29, 2006
439
1
Suffolk, UK
Thats great, I do get it slightly, I see what you mean. I just have to stretch my brain a little more I guess.

I want to thank Steve Kochan as well for being so willing to help, and everyone else who has been on this forum as well.
 

skochan

macrumors regular
Apr 1, 2006
150
0
California
Does anyone know of any resource that will help me understand whats in chapter 3 please? So then once i understand it better I can move on in the book.

Josh,

Send me an email (steve_kochan@mac.com) and I'll try to help you through this. Are you having difficulty with the class/instance concepts, the mechanics of the program example, or both?

Cheers,

Steve
 

wizard

macrumors 68040
May 29, 2003
3,854
571
Maybe formal education would help.

Ok, so I have just finished reading chapter 3 of Programming in Objective-C 2.0 after flying through the content before it with ease.
I haven't read Steves book, I have to many unread books as it is. Given that I'm going to suggest a few things that might help.

1.
Find a local college that has a Comp Science program and get your self into a few classes. Different people learn in different ways but something tells me you might benefit from group learning. If nothing else you will get a little background into the science that can be helpful for a long time after those classes are completed.

2.
Read the book from cover to cover like it was a novel not stopping to do any of the examples, or explore those things that confuse you. Do this in no more than a couple of days. The idea is to prime the mind by breezing through the book and then go back to chapter #1 and start to read for content and develop a solid understanding of the examples and concepts.

3.
Take your time with examples, you need to understand exactly what every statement means precisely. By this I mean you should be able to walk through a program line by line and update every variable in your head just like the computer does.
I have to say it's stopped me in my tracks early, all of chapter 3 on Classes, Objects and Methods I basically didn't understand (except for a couple of bits).
This is an important step as you have to master these ideas if you expect to program iPhone or just about anything else these days. Not to be negative but you either need to grasp this or give up.

We don't want you to give up of course but trying to deal with abstract concepts across a pipe is a tough. The lag makes it difficult at times to latch onto what is the root cause of your trouble. This is where a local course might help substantially. I might also suggest that it might be more useful to learn C first before Objective C though that very statement is likely to cause an uproar.

The problem here is that every mind is different in how it learns and how it handles abstract concepts. Personally I think you would be better off mastering C and learning how some of the difficult things are done in C so that you have a base line for the advantages of Objective C and object orient programming in general. That is me of course, how you manage is another thing.
Any tips on helping me learn this? Other resources or anything which might make it a bit clear?
Here are a few idea to add to the above.
  1. Learn C first.
  2. Read the book completely first.
  3. Walk through each chapter indepth. That means experimenting outside of the examples offered in the book before going on to the next chapter. AS you rpgress you should be able to state all the concepts from the recnetly read chapter and all previoous chapters in depth. If you can't you are not ready for the next chapter.
  4. Read other books on object orient programming. They don't have to be based on Objective C either. The idea is to find material that makes your personal brain click with respect to the concepts.
  5. Once you have spent at least a week on the concepts in the previous chapters take a crack at chapter three again. Inch through it one concept at a time and then post questions here when the brick walls pops up.
  6. Don't post questions about anymore than one stumbling block at a time. Once you break though restart from the beginning of that concept and walk through the chapter again. Each step of the way you ought to understand the concept well enough to create workable code. If you can't write idomatic code based on what you have covered in the book so far it really makes little sense to move ahead.
  7. Realize there is a limit to the personal help you can get over the internet. At your level I really think it is a mistake to rely to much on forums like these for extremely basic skills. The problem is it is possible to get bad advice or heed the wrong advice and end up developing some really bad programming habits.
  8. There is a reason why comp sci courses are as long as they are. You really don't want to gloss over the basics which is what many do when learing from one book.
  9. Before you even think about chapter 3 (based upon what I imagine is in there) you need to have full command of some importnat concepts. This includes program flow control, pointers, stacks, arrays, queus, file I/O, lists, data types and other things from which object orient code is built. It is not just knowing what these items are but beign able to write code that uses these elements without effort. Things like Data types, and pointers are used extensively in Objective C code.
  10. In an way you should be able to take the abstract concepts of programming and overlay them on everyday life. For example you might think of the cupboards in your kitchen as an Array, with in which is stored the arrays contents. The Array might become multidimensional if you consider the shelves. An even beter example of a multidimensional Array is a spice rack with multiple shelves, as each location can only have one type of herb.
  11. An example of a stack can often be found in supermarkets where carts are often arraingened in a stack where carts to be used are removed from where they are inserted into the stack.
  12. No I'm not hungery but these ideas just come to me from time to time. The point is if you can't deal with how the abstract can be mapped to the real world you will have trouble. In C these structures might have simple data types, in Objective C, with Apples Libraries you might have Arrays storing objects as opposed to simple types.
  13. Life is short but don't rush learing this stuff. As mentioned above the colleges take a long time, relatively, to get the students up to a certain level of performance before diving into more advance concepts. At least they did 25 years ago when I took some comp sci courses.
Hope you. An help would really appreciate it, thanks.

I think maybe you got off on the wrong foot here and are in a bit of a rush. Step back take a breather and go to the library to read something loosely related to Objective C. Don't try to understand it but rather just read it through.

Ultimately your success is in your own hands.

dave
 

Josh Kahane

macrumors 6502
Original poster
Aug 29, 2006
439
1
Suffolk, UK
Wow, thanks. Thats alot of information to work with. I'll do my best to for fill most of those things, I'll give my book a couple of thorough read troughs, if I'm still struggling with the concepts I'll try and look at some other book, etc. Thanks.
 

wizard

macrumors 68040
May 29, 2003
3,854
571
A much shorter post!

Wow, thanks. Thats alot of information to work with. I'll do my best to for fill most of those things, I'll give my book a couple of thorough read troughs, if I'm still struggling with the concepts I'll try and look at some other book, etc. Thanks.

Yesterday I was on WiFi at the library and honestly was working on a response to one of your other posts. Let me tell you that posting would have lead to your enlightenment, world peace, the end of hunger and disease. Unfortunately it evaporated on the ether and all I got now for you is a quick iPhone message.

First; I hope I didn't come off to negative about asking questions, frankly if you don't ask questions you can't learn. The problem isn't the questions but the medium. You need to be careful about how and what you ask so that everybody is on the same page.

Second; I might not have stressed the importance of small steps and patience enough. If I read this thread right it has only been like two weeks, that is a pretty fast transition to Object Oriented concepts from ground zero. Now there are ways to introduce some body to Object Oriented technigues right from the beginning, it is just that it is not how I learned what little I know about the craft. I'm a big fan of getting the basics right and building from there.

Third; everybody has there own pace and learning style. It is up to you to find how you latch on to abstract concepts the easiest. This is where asking the right questions can be vital. The goal should be to understand the concept in the same manner that people conversant in the technology do.

Fourth there is nothing iffy about what we are talking about here. For the most part every line of code you write should have a precise meaning or result. Of course all software has bugs or unintended behaviour, but that is never a goal in programming. That is why I suggest that you need to understand what every line of code is doing in every example from every section in a chapter before going onto the next. Writing program fragments that take advantage of those concepts needs to be fluid to you.

Fifth; remember to take your time. You can't really expect to be programming the iPhone in two weeks from ground zero. I don't think that is possible for experienced programmers. The reality is that there is a huge amount of stuff to learn after you learn Objective C the language. The SDK has hurdles of it's own to overcome. It could be several months to a year before you are up to speed.


Well that is all for now!


Dave
 

CocoaPuffs

macrumors 68020
Aug 23, 2008
2,005
3
As a beginner, I highly recommend going through the free lecture course being offered by Stanford: http://see.stanford.edu/ and at least go through everything taught in 106A. This will give you much of the same knowledge you will come across in Kochan's book. After that, which you will have a firm grasp of the basic programming, going through Kochan's book will be an ease.

This way you save the money from having to sign up for classes, and you get a very valuable learning experience in programming.
 

mindriot

macrumors newbie
Feb 15, 2009
1
0
Just a suggestion but I found this book really useful to help me understand some of the basic ideas in programming. "Python programming, an introduction to computer science" by John Zelle.

I think you will find this book useful as I did, its aimed at the complete non-programmer and its using python which is a really straightforward language with virtually no syntax to learn but forces a number of good practices, the book however is not actually about python thought it does teach it along the way, it is really about the basics of computer science and is aimed more at teaching the underlying principles used in all areas of programming. I found that it was the easiest to book to learn how to design a program, breaking down algorithms, how to use simple concepts in powerful ways and how to understand concepts like object orientated design. Its an easy book that is aimed on the foundation blocks of programming and major theoretical areas. Really what i'm trying to say is that its not a book that teaches how to program in language (insert your choice here) its a book about understanding programming that uses python only as an example because it allows you to focus less on the language and more on the concept. Its written by a computer science teacher and its aimed as the primary textbook for the first year of a CS college course.

While i don't really care about python, it has its uses and no doubt you will find a use for it, its not what you want to use for the job you are trying to do. I'm pretty sure that you will however find it a good book to help you digest some of the complex ideas that you have to get your head around. One thing I found pretty good is that due to the goals of the book almost everything in here examples and coursework etc can be completed in any language, so you could work through it, learn a little python and allot of theory or you could just learn the theory and apply it in another language.

The reason I got it was because I had spent allot of time learning programming from various books(at the time was more web applications based) and one thing i found was i got the ideas but i couldn't get the bigger picture, there was also allot of gaps in my background knowledge when i moved on to more complex stuff. I got this book nothing to do with python but because i hoped it would help me understand in greater depth some of the basics, which it did, but i can't get over how much time i would have saved if i read it before reading books teaching what i wanted to do.

http://www.amazon.com/Python-Progra...bs_sr_1?ie=UTF8&s=books&qid=1234741683&sr=8-1 read the reviews and give it some thought.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.