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

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
The 2nd edition of "Programming in Objective-C (2.0)" is being released in November 2008. It's available now for pre-order.

For someone who's currently learning Objective-C and Cocoa development, i would like to order the first edition from 2003, but i'm concerned that Objective C 2.0 will be vastly improved/different... is is worth waiting for this? how great is the difference between Objective-C and Objective-C 2.0?
 

Attachments

  • 413ijRo9hmL._SS500_.jpg
    413ijRo9hmL._SS500_.jpg
    29.4 KB · Views: 425

Cromulent

macrumors 604
Oct 2, 2006
6,802
1,096
The Land of Hope and Glory
You'll need to know Objective-C 1 if you are programming for the iPhone anyway as garbage collection is not available on it. So you'll still be doing your own memory management. Objective-C 1 is fine to use.

There are some nice features to Objective-C 2 but you'll do just fine with the 2003 book.
 

North Bronson

macrumors 6502
Oct 31, 2007
395
1
San José
You'll need to know Objective-C 1 if you are programming for the iPhone anyway as garbage collection is not available on it. So you'll still be doing your own memory management. Objective-C 1 is fine to use.

There are some nice features to Objective-C 2 but you'll do just fine with the 2003 book.

Isn't Garbage Collection part of Foundation?

When I read Kochan's book the whole first half was devoted to Objective-C *independent* of Cocoa frameworks (which I think is a good way to learn). Wouldn't Kochan have to use retain counts if he wasn't using Cocoa?
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
Isn't Garbage Collection part of Foundation?

When I read Kochan's book the whole first half was devoted to Objective-C *independent* of Cocoa frameworks (which I think is a good way to learn). Wouldn't Kochan have to use retain counts if he wasn't using Cocoa?

Retain counts are a manual means of memory management. The runtime is just kindly enough to dealloc things when their retain count reaches zero for you, but there is no object graph used, and the reference counting is not done for you. The autorelease pool helps "automate" memory management, but is not a replacement for real garbage collection.

It is somewhat confusing, as retain counts and the runtime dealing with deallocation for you does seem sort of "garbage collecty". However the garbage collection introduced in Objective-C 2.0 is what a programmer used to GC'd languages like Java, the .NET family, and many functional languages like Lisp and Haskell would expect. It is completely automatic, and the programmer doesn't have to directly deal with managing the retain/reference counts. The problem this can cause is leaking of references, which would be the same as leaking memory in the absence of GC, and can be quite difficult to track down.

-Lee
 

skochan

macrumors regular
Apr 1, 2006
150
0
California
Isn't Garbage Collection part of Foundation?

When I read Kochan's book the whole first half was devoted to Objective-C *independent* of Cocoa frameworks (which I think is a good way to learn). Wouldn't Kochan have to use retain counts if he wasn't using Cocoa?

Because garbage collection isn't supported on the iPhone, and because I believe it's important to understand object ownership, memory management is still emphasized throughout the second edition of the book. The primary changes to the second edition include the incorporation of the new objective-C 2.0 features (such as properties, synthesized accessors, and fast enumeration), the use of NSObject from the start as the root object (the first edition used Object), and a chapter that introduces how to write an iPhone application. All feedback is welcome.

Cheers,

Steve Kochan
 

toddburch

macrumors 6502a
Dec 4, 2006
748
0
Katy, Texas
Hey Steve. I'm going through the first edition right now. I really like it. I read really slow and try to absorb as much as I can. I'm on chapter 15, and have only noticed one very insignificant typo so far. Very good job. I can't stand it when I'm "correcting the author" when I'm reading.

Todd
 

GorillaPaws

macrumors 6502a
Oct 26, 2003
932
8
Richmond, VA
Because garbage collection isn't supported on the iPhone, and because I believe it's important to understand object ownership, memory management is still emphasized throughout the second edition of the book. The primary changes to the second edition include the incorporation of the new objective-C 2.0 features (such as properties, synthesized accessors, and fast enumeration), the use of NSObject from the start as the root object (the first edition used Object), and a chapter that introduces how to write an iPhone application. All feedback is welcome.

Cheers,

Steve Kochan

Hey Steve, I can't say enough good things about your book. I did find the bitwise operation section to be less polished than the rest of the text however, and it seems others on Amazon had commented on this as well. Did you happen to revisit that particular section in the 2nd edition at all?

Also, do you have any interest in writing a learning Cocoa book for people who just finnished your Objective-C book, possibly in a joint effort with Hillegass'? One of my criticisms of Hillegass' excellent book is that it seems to lack the degree of detailed analysis of what the code is doing (even when it's repetition) that was present in your book. I found this strategy in "Programming in Objective-C" to be a critical part in the learning process for me, and think others trying to learn how to program for the first time on a Mac would really benefit from your lucid writing style.
 

toddburch

macrumors 6502a
Dec 4, 2006
748
0
Katy, Texas
The primary changes to the second edition include ... the use of NSObject from the start as the root object (the first edition used Object)...

I thought the use of Object (vs NSObject) from the beginning was fine, as it allowed the reader to focus on the whole OO paradigm versus getting immersed straight into a huge framework from the get-go. Perhaps you can make a side-note of it's use in the appendix?
 

laprej

macrumors regular
Oct 14, 2005
108
2
Troy, NY
This thread reminded me it was coming out soon. Fortunately, I received two B&N gift cards for Christmas so this time around there was absolutely no hesitation! :)
 

roamy

macrumors member
Feb 15, 2008
32
0
Well here is a dilemma - I can't program at all. I want to write a enterprise web app. Lets say another Ebay. As of today my option seems only Java. However does anyone out there think we may see a Cocoa ability to create enterprise apps with the coming of ObjC 2?

Now for anyone answering forget it period if you can't program then lets assume I am a expert but don't know Java or Obj C
 

Cromulent

macrumors 604
Oct 2, 2006
6,802
1,096
The Land of Hope and Glory
Well here is a dilemma - I can't program at all. I want to write a enterprise web app. Lets say another Ebay. As of today my option seems only Java. However does anyone out there think we may see a Cocoa ability to create enterprise apps with the coming of ObjC 2?

Now for anyone answering forget it period if you can't program then lets assume I am a expert but don't know Java or Obj C

Apple does have an enterprise web app solution. It is called Web Objects and is based on Java.
 

roamy

macrumors member
Feb 15, 2008
32
0
Apple does have an enterprise web app solution. It is called Web Objects and is based on Java.

Thank you Cromulent - I am very aware of WO. I am wondering if they will have a web app solution with Cocoa as they currently do not.
WO was great when it had the tools
 

skochan

macrumors regular
Apr 1, 2006
150
0
California
Hey Steve, I can't say enough good things about your book. I did find the bitwise operation section to be less polished than the rest of the text however, and it seems others on Amazon had commented on this as well. Did you happen to revisit that particular section in the 2nd edition at all?

I had an expanded description of the bitwise operators in Programming in C, but I decided to scale it back for the Objective-C title. Bad decision! I restored the more detailed explanation in the second edition. There are now truth tables for all the operators, and the explanations are not so terse!

Cheers,

Steve Kochan
 

skochan

macrumors regular
Apr 1, 2006
150
0
California
In the new edition, are you getting rid of the deprecated methods like cString?


Yes, because this edition starts from the beginning with NSObject (instead of Object), I use NSLog almost exclusively instead of printf. That allows string objects to be displayed directly without having to first convert them to C-strings.
 

skochan

macrumors regular
Apr 1, 2006
150
0
California
I thought the use of Object (vs NSObject) from the beginning was fine, as it allowed the reader to focus on the whole OO paradigm versus getting immersed straight into a huge framework from the get-go. Perhaps you can make a side-note of it's use in the appendix?

In the first edition, I was hoping Objective-C would really catch on as a cross-platform development language. Thus the use of Object instead of NSObject, and coverage of the Foundation Framework in the second part, which does allow portable, multi-platform applications to be developed.

Five years later, Objective-C remains primarily a Mac application development language. So, I gave in and decided to start with NSObject out of the box, but there's still no real coverage of the framework (other the autorelease pool that XCode automatically sets up) until the second part of the book, which is consistent with the first edition.

I also added another section to take the reader through the process of getting a program to run on an iPhone. In this case, the Calculator and Fraction classes that are developed throughout the text are used to develop a simple iPhone Fraction calculator. This serves as an introduction to the world of Cocoa and iPhone application development and ties everything together. By no means is this introductory chapter designed to replace any of the excellent Cocoa texts out there.


Cheers,

Steve Kochan
 

skochan

macrumors regular
Apr 1, 2006
150
0
California
I'm looking into this book too. Amazon.com has it down for a US release on January 2nd, with a UK version launching later in that month. The cover makes specific reference to iPhone development.

http://www.amazon.co.uk/gp/product/0321566157/

See my answer in #18. There is an introduction to iPhone development. You are taken through the steps involved in designing an iPhone Fraction calculator, including building the interface with Interface Builder. However, this is not a tutorial on iPhone or Cocoa programming, as it covers just developing two particular types of applications on the iPhone.

Cheers,

Steve
 

skochan

macrumors regular
Apr 1, 2006
150
0
California
Also, do you have any interest in writing a learning Cocoa book for people who just finnished your Objective-C book, possibly in a joint effort with Hillegass'? One of my criticisms of Hillegass' excellent book is that it seems to lack the degree of detailed analysis of what the code is doing (even when it's repetition) that was present in your book. I found this strategy in "Programming in Objective-C" to be a critical part in the learning process for me, and think others trying to learn how to program for the first time on a Mac would really benefit from your lucid writing style.

Thanks much. I have thought about it. Unfortunately, I'll have to leave it at that for now. :)
 

softweyr

macrumors newbie
Dec 6, 2007
12
0
San Diego
Well here is a dilemma - I can't program at all. I want to write a enterprise web app. Lets say another Ebay. As of today my option seems only Java. However does anyone out there think we may see a Cocoa ability to create enterprise apps with the coming of ObjC 2?

Now for anyone answering forget it period if you can't program then lets assume I am a expert but don't know Java or Obj C

There are lots of alternatives, some of which run on the Mac. You didn't mention platform, so let me toss out the obvious Windows .NET suggestion. Other combinations based on Java include NetBeans/EJB/GlassFish and several different webapp environments that plug directly into Eclipse. Non-Java frameworks basically boil down to Ruby on Rails and PHP and *Sql on (your favorite unixy OS here). My favorite are BAPPs (BSD, Apache, PHP, PostgreSQL) but feel free to mix-n-match according to your own preferences.

Xcode, NetBeans, and Eclipse all have editor support for the common web languages like Ruby and PHP these days, so you have an embarassment of riches at hand for development tools.

I haven't found any web development frameworks written in Obj-C, or C or C++. I'm not sure of the reason, other than languages like PHP and environments like Rails have been designed with the flow of web programming in mind and have done a very good job. Java grew up with the web and so a large percentage of the "real programmers" that went into web programming did so with Java. The Java frameworks and servers that have survived are genuinely useful stable platforms with thousands (or more) users and useful documentation.
 

roamy

macrumors member
Feb 15, 2008
32
0
There are lots of alternatives, some of which run on the Mac. You didn't mention platform, so let me toss out the obvious Windows .NET suggestion. Other combinations based on Java include NetBeans/EJB/GlassFish and several different webapp environments that plug directly into Eclipse. Non-Java frameworks basically boil down to Ruby on Rails and PHP and *Sql on (your favorite unixy OS here). My favorite are BAPPs (BSD, Apache, PHP, PostgreSQL) but feel free to mix-n-match according to your own preferences.

Xcode, NetBeans, and Eclipse all have editor support for the common web languages like Ruby and PHP these days, so you have an embarassment of riches at hand for development tools.

I haven't found any web development frameworks written in Obj-C, or C or C++. I'm not sure of the reason, other than languages like PHP and environments like Rails have been designed with the flow of web programming in mind and have done a very good job. Java grew up with the web and so a large percentage of the "real programmers" that went into web programming did so with Java. The Java frameworks and servers that have survived are genuinely useful stable platforms with thousands (or more) users and useful documentation.
thank you for your response. I guess maybe it is just wishful thinking that Mac would replace WO. I am trying Netbeans visual web and it seems to be coming along. I guess I will compare that to WOLips and rails after Macworld. It seems that many WO developers are migrating to Rails.
 

mdeh

macrumors 6502
Jan 3, 2009
345
2
In the first edition, I was hoping Objective-C would really catch on as a cross-platform development language. Thus the use of Object instead of NSObject, and coverage of the Foundation Framework in the second part, which does allow portable, multi-platform applications to be developed.

Hi Steve...your new book arrived today. Just skimming through it, I see it has largely been rewritten with the new 2.0 features.

I **assume** :) those questions incorporating new terminology are posted somewhere??? Could you let us know where these are, so the more industrious of us can **really** get to learn it. Thanks.
 

skochan

macrumors regular
Apr 1, 2006
150
0
California
I **assume** :) those questions incorporating new terminology are posted somewhere??? Could you let us know where these are, so the more industrious of us can **really** get to learn it. Thanks.

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)

Cheers,

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