Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Here's a thought: I'll accept contributions (code, not $$$) for the even-numbered exercises via email, provide comments and give you credit if I use it. (Does that sound too desperate? :D)

Nope! I would love that challenge, as I am sure will others. But all the questions & answers need to be looked at in terms of the new headers and new dot notation for the accessors etc... I know from going through C and religiously going through the exercises in K&R how frustrating it was to find that the "C answer book" was outdated (Not that yours would be to the same degree). The beauty of a book like yours is that it is not only well explained, but offers the opportunity to feel one is really learning the language by doing the exercises, and more importantly, able to verify one's answers. I know it's asking a lot, but your publisher has put you in a corner by offering the answers on the informit website...which clearly has not yet happened. At least take heart from the fact that in this dire economy, you are one of the few left actually producing something new!!! :)
 
When Will Code Be Published?

I have worked through my copy of the 2nd Edition (the first printing run) and, alas, the code for the final project (Fraction_Calculator) does not work as given in the book. I pasted the code directly from the Safari page online, but I can not for the life of me figure out why it doesn't work. The initial code compiles with 37 errors and 2 warnings!

I have found a couple errors already, but they have not solved all the problems. For some reason the "displayString" is null.

When are errata and code going to be posted?
 
I have worked through my copy of the 2nd Edition (the first printing run) and, alas, the code for the final project (Fraction_Calculator) does not work as given in the book.

YIKES!

These days publishing schedules have become so tight (due to increased pressure from free stuff on the Internet), that books today are going out with more problems than they used to (I've been writing for a while, as was pointed out in a previous post! ).

I tried hard to carefully read through the pages from the publisher, but it's not possible to catch everything. My first edition had over 100 typos! Many typos get introduced in conversion of the Word files to their internal publishing software (don't know what they're using now). I believe this 2nd edition is cleaner, but I've noticed the typos are starting to get recognized. I don't mean to complain, but you don't know what it's like to go through and circle all the quotes that are going in the wrong direction. All single character constants like 'A' were set by the publisher as `A' !!! As another example, their conversion chewed up many of my NSLog (@"....."); statements because it apparently thought that (@" was the start of special formatting. When you get distracted with things like quotes and NSLog statements, it's harder to focus on the content. Anyway, enough complaining.

Back to the problem. I desk-checked the text against my source code. Here's what I found:

Page 480: Title at the bottom of the page should be:
Program 21.2 Fraction_CalculatorViewController.h Interface File

Page 481: Seems like it got all messed up at the bottom of the page with the wrong code. This I think is source of most, if not all, of your errors.

Replace all 4 program lines with:

#import "Fraction_CalculatorViewController.h"
@implementation Fraction_CalculatorViewController

-(void) viewDidLoad {


Page 482: remove the line that reads

[window makeKeyandVisible];

Page 484: remove the line that reads

[window release];

I don't have access to the online version :)rolleyes:). If you cut and paste the code from there and then email it to me (steve_kochan@mac.com), I'll insert the above changes and verify that the program works.

I apologize for the errors. I will post an errata page soon...probably within the week. In the meantime, feel free to continue to post or email me with any more problem you find.

Cheers,

Steve Kochan
 
Additional Changes to Make Chapter 21 Fraction_Calculator Work

Stephen,

Thank you for the prompt reply!!! I applied your corrections, and there were still several more typos, but I list them below:

p. 480 Program 21.2 Fraction_CalculatorViewController.h
Requires @end at the end of the code​

p. 481 Program 21.2 Fraction_CalculatorViewController.m
Add the two @synthesize lines below​

#import "Fraction_CalculatorViewController.h"
@implementation Fraction_CalculatorViewController
@synthesize display;
@synthesize displayString;

-(void) viewDidLoad {​

I was then able to get the program to run. There is still some weird behavior I want to track down. When you first start the program (prior to doing anything else), if you enter a single number, such as 5 into the calculator and press the = button, the program crashes out to gdb with the following errors:

warning: Unable to read symbols from "UIKit" (not yet mapped into memory).
warning: Unable to read symbols for "/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics" (file not found).
warning: Unable to read symbols from "CoreGraphics" (not yet mapped into memory).

If you do the same thing after doing a normal fraction calculation, you get a line such as 5 = 5, which is correct.

Marc
 
There is still some weird behavior I want to track down. When you first start the program (prior to doing anything else), if you enter a single number, such as 5 into the calculator and press the = button, the program crashes out to gdb with the following errors:

warning: Unable to read symbols from "UIKit" (not yet mapped into memory).
warning: Unable to read symbols for "/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics" (file not found).
warning: Unable to read symbols from "CoreGraphics" (not yet mapped into memory).

If you do the same thing after doing a normal fraction calculation, you get a line such as 5 = 5, which is correct.

Marc

Marc,

Thanks for correcting my corrections! I've been looking at the code too long; that's what happens after several rounds of proof-reading.

As for your problem, that's actually a bug in the code and not a typo! In fact, this was pointed out to me late in the game by Mike Trent, my tech reviewer. It has to do with the fact that the variable op has not been set when you press the equals key without first entering an operation. This leads to a crash in the performOperation: method due to the fact that the result variable never gets set. I'll leave it up to you to address this in your code! :)

Cheers,

Steve Kochan
 
New Book

I've had the first Programming in Objective C book for about a two months now (I didn't realize a new one was coming out so soon). Is it worth getting the new one or should I finish up with the first one?

(The reason that it's taking be some time to get through it is that I have a heavy course load and am taking AP Comp Sci, which is all in java and having to switch between the two can get a little confusing)
 
I tried hard to carefully read through the pages from the publisher, but it's not possible to catch everything. My first edition had over 100 typos! Many typos get introduced in conversion of the Word files to their internal publishing software (don't know what they're using now). I believe this 2nd edition is cleaner, but I've noticed the typos are starting to get recognized.

The Pragmatic Programmers publishing house has started using a concept called the beta book program whereby pre-ordering customers gain access to a pre-release electronic version of the text while the book is going through its final revisions. They are later shipped the final product when it is officially released. In this beta stage, all of those extra eyes help catch errors before they go to print.

I'm guessing that wasn't an option with your publishers for this book, but it might be worth having your editors look into exploring something similar for your next project. Maybe we should all band together and write a cocoa version of their internal publishing software :eek:.
 
Calculator crash if no operation is requested.

I got the same result. I modified my clickEquals action to the following and all seems to work fine...

-(IBAction) clickEquals: (id) sender {
[self storeFracPart];
if(!firstOperand) {
[myCalculator performOperation: op];
}
[displayString appendString: @" = "];
[displayString appendString: (!firstOperand) ? [myCalculator.accumulator convertToString] : [myCalculator.operand1 convertToString]];
[display setText: displayString];

currentNumber = 0;
isNumerator = YES;
firstOperand = YES;
[displayString setString: @""];
}

Kevin


Stephen,

Thank you for the prompt reply!!! I applied your corrections, and there were still several more typos, but I list them below:

p. 480 Program 21.2 Fraction_CalculatorViewController.h
Requires @end at the end of the code​

p. 481 Program 21.2 Fraction_CalculatorViewController.m
Add the two @synthesize lines below​

#import "Fraction_CalculatorViewController.h"
@implementation Fraction_CalculatorViewController
@synthesize display;
@synthesize displayString;

-(void) viewDidLoad {​

I was then able to get the program to run. There is still some weird behavior I want to track down. When you first start the program (prior to doing anything else), if you enter a single number, such as 5 into the calculator and press the = button, the program crashes out to gdb with the following errors:

warning: Unable to read symbols from "UIKit" (not yet mapped into memory).
warning: Unable to read symbols for "/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics" (file not found).
warning: Unable to read symbols from "CoreGraphics" (not yet mapped into memory).

If you do the same thing after doing a normal fraction calculation, you get a line such as 5 = 5, which is correct.

Marc
 
To buy or not to buy

I am currently learning C and will move straight to O-C afterward. I already bought the 1st Ed of Stephen's O-C in anticipation of that. I had no idea the new edition was about to come out.

Is there enough new stuff and is it Mac-centric enough that I should buy the new edition and write off the money spent on the first one?

Also, I have been looking for an accompany book to use with K&R as I am learning that is Mac-centric. Should I buy the new C on Mac edition or get Stephens C Programming book I have heard so much about?

My concern is that the C book might be a little dated in regards to Mac Xtools Dev.

Thanks for any answers.

Jeff
 
Is there enough new stuff and is it Mac-centric enough that I should buy the new edition and write off the money spent on the first one?

Hi Jeff,

I wouldn't invest in the second edition. Work through the first edition you have then go to Apple's website to read up on the changes added to Objective-C 2.0 (Don't have the link to the document handy).

You can also ask questions about anything related to the first edition or about Objective-C in general on the forum I set up for the book at classroomM.com/objective-c.

As for my C book, it's not Mac-specific at all. It's a general tutorial on C and is fully up-to-date with respect to the language. Since it's not a Mac-oriented book, there's really no instructions on using Xcode, Mac OS X, etc.

Good luck! Hope this helps.

Cheers,

Steve Kochan
 
Hi Jeff,

I wouldn't invest in the second edition. Work through the first edition you have then go to Apple's website to read up on the changes added to Objective-C 2.0 (Don't have the link to the document handy).

You can also ask questions about anything related to the first edition or about Objective-C in general on the forum I set up for the book at classroomM.com/objective-c.

As for my C book, it's not Mac-specific at all. It's a general tutorial on C and is fully up-to-date with respect to the language. Since it's not a Mac-oriented book, there's really no instructions on using Xcode, Mac OS X, etc.

Good luck! Hope this helps.

Cheers,

Steve Kochan

Thanks Steve...you are a good man to recommend "not" buying your book. Even for the right reasons. I have heard so many great things about your C book I think I am going to get it as my companion to K&R.

From what I can gather there are 3 truly great books in C programming. K&R, your book and Kings "Modern" book.

I am heading to the forums now. I am really really loving C. Much more so than C++. It would be really funny if an older language like C came back and took out newer languages as the preferred Dev Language. It has its oddities but there is something truly elegant about the language that most other high languages lack. Maybe it is just because it is so close to the hardware. "Power to the C."

Cheers on the flip side,
Jeff
 
Fraction Calculator

I just bought the book (Objective-C by Stephen Kochan). I do not
yet have a Mac, but I'm planning on getting one so I can try some iPhone apps.

In the meantime, I wanted to run the fraction calculator on my iPod Touch.
Is that app available on the web somewhere? How about the other code in
the book. Is it available for download somewhere?

Sam Rhoads
 
I just bought the book (Objective-C by Stephen Kochan). I do not
yet have a Mac, but I'm planning on getting one so I can try some iPhone apps.

In the meantime, I wanted to run the fraction calculator on my iPod Touch.
Is that app available on the web somewhere? How about the other code in
the book. Is it available for download somewhere?

Sam Rhoads

Sam,

Program examples, quizzes, questions, etc. are available at the forum for the book: www.classroomM.com/objective-c.

You need a Mac and you need to register with Apple for the iPhone developer program to get the Fraction Calculator app installed on your iPhone/iPod Touch. The only other way to get an app onto to your (non-jailbroken) iPod Touch would be through the App Store. The fraction calculator is not available from the App Store.

In the book you learn how to write an iPhone application that you can run and debug on the Mac using the iPhone Simulator that is distributed as part of the iPhone SDK. But once again, you need a Mac.

Cheers,

Steve Kochan
 
Hi,

I just started reading the book. My question is do you guys think I should do every exercise, or is it enough if I start doing them in Section II of the book (p. ~300)? I am a computer scientist so I know some programming languages - including Smalltalk. I definitely plan on reading the whole thing - just don't really want to do all the exercises.

Whats your opinion?

Henrik
 
Hi,

I just started reading the book. My question is do you guys think I should do every exercise, or is it enough if I start doing them in Section II of the book (p. ~300)? I am a computer scientist so I know some programming languages - including Smalltalk. I definitely plan on reading the whole thing - just don't really want to do all the exercises.

Whats your opinion?

Henrik

You should always do the exercises. If you already know it then they should be easy and you can confirm that with yourself.

If you find them hard, then there is something that you have misunderstood and you know that you are not ready to move on yet.
 
though it might be helpful to post the "Corrections of 1st Printing" .PDF here...
 

Attachments

  • Programming In Objective-C 2.0 Corrections.pdf
    132.7 KB · Views: 389
Thanks for posting that. It's really the corrections for the 1st and 2nd printings. If you have a PDF or Safari Books online version, then it's just for the 1st printing (don't ask!).

The forum noted about five posts back also has corrections after these printings posted as well.

Cheers,

Steve Kochan
 
I'm not sure what you mean by questions. I assume you mean answers to exercises? No, the code and the answers to the exercises haven't been posted yet. I just got the book done before the holidays, so now I need to sit down and actually work out the answers to the even-numbered exercises, which I didn't even do for the first edition. It's quite a time consuming task (as I was writing some of the exercises I was grimacing at the thought of having to answer a couple of the harder ones myself). It's my top priority. I'm hoping to set up a web site shortly (or use my mac home page as I'm doing now) for errata, answers to exercises, and the source code from the book.

Feel free to pester me! :)

Here's a thought: I'll accept contributions (code, not $$$) for the even-numbered exercises via email, provide comments and give you credit if I use it. (Does that sound too desperate? :D)

I realize this is an old thread, but I have begun to work through my copy of the book, and am wondering if any answers have been published on the web by the author, Mr. Kochan. I found this forum: http://classroomm.com/objective-c/index.php?board=3.0, but would prefer answers given by the author.

Also, I saw that the third edition of the book will becoming out shortly. Will there be answers in there?
 
I do two things that are a bit controversial:

1. I don't post the source code - I think that a big part of the learning process is gained by typing in the examples. That way you learn how to recognize and fix compiler errors. You don't get that by cutting and pasting the examples. With that said, readers have posted the code to the forum. I still recommend every reader type the examples in anyway!

2. I don't publish "official" exercise solutions. Again, there's so much of the learning process to be gained by working through the exercises. I like the fact that readers have published different solutions, and I'm happy to review a posted solution from a forum member. I did "sticky" the exercise solutions from one particular forum member that I did review and considered to be excellent solutions. In the past I've posted answers to odd-numbered exercises for my other books and earlier editions. That was based on requests by instructors that not all the answers be published so that exercises could be given as class assignments. So this has not been a "static" position I've held. As for the third edition, the exercises are mainly unchanged, and the answers are not included in the text itself.

I realize that not everyone agrees with my methodology here. But I do spend a lot of time on the forum personally answering as many posts as I can. :).

Cheers,

Steve
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.