Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > If It's Supposedly So Easy, Then Why Is It So Difficult

If It's Supposedly So Easy, Then Why Is It So Difficult
Thread Tools
Kestral
Senior User
Join Date: Mar 2001
Location: Toronto, Ontario, Canada
Status: Offline
Reply With Quote
Dec 26, 2001, 04:18 AM
 
From what I understand, when the NeXT machines came out, their huge selling point was that it allowed regular people to easily develop applications for the platform. That was the advantage of object oriented programming.

So if it's so easy, then why am I finding it so difficult to learn to program? Supposedly I have to learn C to better understand Cocoa, so I've been plowing through "Learn C on the Macintosh" as well as "Learn C in 21 Days". I'm also doing some Cocoa tutorials using Interface Builder. As far as I see, the two things I'm doing have nothing in common and quite simply, I'm confused.

Then I read about books like "Cocoa Programming for Mac OS X" and "Learning Cocoa", but the books say you need to know C++ first, and in order to know C++, the best thing to do is to learn C, so I'm back at square one.

All I want to do is to learn how to do some programming, supposedly Cocoa is supposed to be easy, but if I have to learn all this complex stuff to get to the easy, then what's the point of it being easy at all? That's like saying one has to go through 4 years of college in an arts program before you can render a lens flare in Photoshop.

So could someone tell me straight up, no BS, how to learn to program Cocoa? If it's a book, I'll get it and go through it, if there's a huge web site tutorial, I'll go through it - but I'm finding this whole learn C to learn C++ and then go to Cocoa to be quite unwieldy. Surely there is a better way...?
     
Xeo
Moderator Emeritus
Join Date: Mar 2001
Location: Austin, MN, USA
Status: Offline
Reply With Quote
Dec 26, 2001, 04:52 AM
 
I'm in the same boat as you. I want to make my own Cocoa apps but I have to find the time to first learn the languages behind it. Here's my understanding as of now.

Most Cocoa apps are written in Objective-C. That is based on C. If you know C, then you can apply all that knowledge to Obj-C and just pick up any extras along the way. C++ isn't a necessity but since it's also based on C, if you already know it you have much of the foundation there. If you don't know C++, then don't learn it. Go from C to Obj-C. On the other hand, there is Java. I don't think it is used as much but it's a possibility.

You don't program in Cocoa. Cocoa is a framework. It's basically a set of hooks and "freebies" that you get without having to program everything yourself. It's also native only to OS X unlike Carbon.

The easy part you're looking for comes with all those freebies. To implement a "find" feature it's nothing more than a few lines of code. The same goes for a spell checker. All you need to do is call it. Also, with Interface Builder, you make your app look exactly how you want it. Interfaces for programming languages like Java alone have to be written in words. You have to tell it in code where all the different buttons and check boxes go. It's not nearly as easy as dragging your button to the place you want it and going from there.

I don't think you have to become fluent in C before starting with Obj-C. Being familiar with it would help. I'm sure you'll be able to learn C by learning Obj-C while making your first Cocoa app. I've found programming to be a whole lot easier when having a task to accomplish. I'm not much on books and reading. Just point me to the reference library and set me loose.

Sorry if I'm wrong about any of this... As I said, this is my understanding so please correct me if I'm wrong.

[ 12-26-2001: Message edited by: Xeo ]
     
moki
Ambrosia - el Presidente
Join Date: Sep 2000
Location: Rochester, NY
Status: Offline
Reply With Quote
Dec 26, 2001, 05:33 AM
 
Writing Cocoa apps is easy, *if* you know Cocoa, and have a good firm grounding in OOP design and programming. If you don't know those two things, then no, it isn't easy.

I suggest going here: http://www.stepwise.com/Articles/VermontRecipes/
Andrew Welch / el Presidente / Ambrosia Software, Inc.
     
moki
Ambrosia - el Presidente
Join Date: Sep 2000
Location: Rochester, NY
Status: Offline
Reply With Quote
Dec 26, 2001, 05:35 AM
 
...and yes, you should be fluent in C as well. OOP isn't a holy grail, btw -- it does make some things more convenient, but it can make some things more difficult as well. OOP is just a methodological tool -- you can write OO code in any language, including assembler.

The one thing you will find in doing OO programming is that more of your time is spent actually designing your object hierarchies and interactions, and less coding, at least compared to straight procedural programming. This is a good thing in that it forces you to really come up with a good design, because if you don't, you can end up with a real mess down the line.
Andrew Welch / el Presidente / Ambrosia Software, Inc.
     
edddeduck
Mac Elite
Join Date: Mar 2001
Location: London
Status: Offline
Reply With Quote
Dec 26, 2001, 08:00 AM
 
IMHO learning C++ is hinderance not a help as I keep trying to do C++ style code not Obj-C. Get a Objective C in 24 hours style book and start that's the best way. Knowledge of other languages is a advantage not a necessity.

Cocoa and the NEXT solution make it easy to code for programmers not average joe's off the street. That first step is always going to be hard. The point is once you know the language the API's have a lot of advantages and make coding faster and enable you to create more features in less time.

This is my understanding

Cheers Edd
     
petej
Dedicated MacNNer
Join Date: Oct 2001
Location: Baltimore, MD, US
Status: Offline
Reply With Quote
Dec 26, 2001, 09:49 AM
 
Apple supplies some terrific documentation with their developer tools. If you have the dev tools installed, open the Developer Help Center docs in the help viewer (one way is to invoke help from finder, then click the question mark button in the lower-left of the window -- a link to Developer Help Center will be toward the bottom of the list). In the Developer Center, click on the "Cocoa" link, which will take you to a page on Cocoa programming resources (the same stuff is available on Apple's website, but if you have the dev tools, you already downloaded it, so you'll see stuff faster). In particular, the items under Getting Started are supposed to be pretty good. The PDF file "Object-Oriented Programming and the Objective-C Language" is supposed to be an excellent introduction to Objective C.

You do not need to know C++ to use Cocoa, and it's probably better if you avoid it, because C++ and Objective C have very different approaches to certain OO problems.

You can also write Cocoa apps in Java, if the mood strikes you; the Apple docs have resources for you on this.

Finally, if you have some familiarity with AppleScript, check out the AppleScript Studio docs. AppleScript lets you build very nice apps taking advantage of Cocoa features, but you don't actually have to know much Cocoa to get started. There are tutorials on this.

Bottom line is that if you have the dev tools, there's a wealth of high-quality documentation sitting on your hard disk, waiting for you to read it.
     
suthercd
Senior User
Join Date: Oct 2000
Location: Midwest
Status: Offline
Reply With Quote
Dec 26, 2001, 10:18 AM
 
petej-

Great resource. Thank you for pointing to the path for this.

Craig
     
leperkuhn
Senior User
Join Date: Feb 2000
Location: Burlington, VT, USA
Status: Offline
Reply With Quote
Dec 26, 2001, 11:37 AM
 
Originally posted by Kestral:
<STRONG>From what I understand, when the NeXT machines came out, their huge selling point was that it allowed regular people to easily develop applications for the platform. That was the advantage of object oriented programming.

So if it's so easy, then why am I finding it so difficult to learn to program? Supposedly I have to learn C to better understand Cocoa, so I've been plowing through "Learn C on the Macintosh" as well as "Learn C in 21 Days". I'm also doing some Cocoa tutorials using Interface Builder. As far as I see, the two things I'm doing have nothing in common and quite simply, I'm confused.

Then I read about books like "Cocoa Programming for Mac OS X" and "Learning Cocoa", but the books say you need to know C++ first, and in order to know C++, the best thing to do is to learn C, so I'm back at square one.

All I want to do is to learn how to do some programming, supposedly Cocoa is supposed to be easy, but if I have to learn all this complex stuff to get to the easy, then what's the point of it being easy at all? That's like saying one has to go through 4 years of college in an arts program before you can render a lens flare in Photoshop.

So could someone tell me straight up, no BS, how to learn to program Cocoa? If it's a book, I'll get it and go through it, if there's a huge web site tutorial, I'll go through it - but I'm finding this whole learn C to learn C++ and then go to Cocoa to be quite unwieldy. Surely there is a better way...?</STRONG>
learning to program isn't easy. I've been doing it for about 10 years, learning it is difficult. Object oriented programming is just a style, i don't think its easier to learn. I'd suggest learning fundamental concepts of C, arrays, memory allocation, structures, how functions generally work. i try not to focus on a specific language implementation, but concepts surrounding it. that's why many programmers (including myself) can learn java, assembly (blah) scheme (a varient of lisp) C, whatever. So, in a nutshell, i suppose you should learn the basics of C.
     
CharlesS
Posting Junkie
Join Date: Dec 2000
Status: Offline
Reply With Quote
Dec 26, 2001, 05:45 PM
 
Take it from someone who unsuccessfully tried to learn the Mac Toolbox many times before giving up. Cocoa is much easier to learn. It seems confusing at first, but once you keep at it for a while, it gets a lot easier once you understand it.

Ticking sound coming from a .pkg package? Don't let the .bom go off! Inspect it first with Pacifist. Macworld - five mice!
     
dtc
Dedicated MacNNer
Join Date: Sep 2000
Location: Bay Area, CA, USA
Status: Offline
Reply With Quote
Dec 26, 2001, 08:07 PM
 
Are you kidding? Apparently you weren't at WWDC where the #1 complaint from Mac developers above all (well.. not above the crappy perf in OS X) was DOCUMENTATION.

Or the lack thereof.

Originally posted by petej:
<STRONG>Apple supplies some terrific documentation with their developer tools. </STRONG>
     
Kestral  (op)
Senior User
Join Date: Mar 2001
Location: Toronto, Ontario, Canada
Status: Offline
Reply With Quote
Dec 26, 2001, 08:32 PM
 
Originally posted by suthercd:
<STRONG>petej-

Great resource. Thank you for pointing to the path for this.

Craig</STRONG>
Wow, this is great, thanks to everyone for the great suggestions and words of encouragement. CharlesS, it sounds like you're having a lot of success learning Cocoa, are there any web based tutorials/links you would recommend?
     
MacAgent
Senior User
Join Date: Dec 2000
Location: Manticore
Status: Offline
Reply With Quote
Dec 26, 2001, 08:40 PM
 
I have the same problem. I've bought over 10 different books on C, ObjC, Cocoa, and all of them say I have to know something else to start. They're also rather confusing.

The only languages I've learned are REALbasic and AppleScript, and I'm working in AppleScript Studio now, which is nice, but I want to do some of the stuff that only Cocoa can do. So, I guess I'll try again...
     
Kestral  (op)
Senior User
Join Date: Mar 2001
Location: Toronto, Ontario, Canada
Status: Offline
Reply With Quote
Dec 26, 2001, 08:43 PM
 
Originally posted by MacAgent:
<STRONG>I have the same problem. I've bought over 10 different books on C, ObjC, Cocoa, and all of them say I have to know something else to start. They're also rather confusing. </STRONG>
No kidding!! It reminds me of the kind of tech support nightmare WinTel users must go through - their computer doesn't work, so they call Dell, Dell tells them it's ATi's problem, call ATi and they blame it on Microsoft, call Microsoft and they blame it on Creative Labs (maker of Soundblaster), call Creative Labs and blame it on Intel, call Intel... etc etc etc...

Will someone just give us the straight dope, pure and uncut?
     
petej
Dedicated MacNNer
Join Date: Oct 2001
Location: Baltimore, MD, US
Status: Offline
Reply With Quote
Dec 26, 2001, 09:47 PM
 
Originally posted by dtc:
<STRONG>Are you kidding? Apparently you weren't at WWDC where the #1 complaint from Mac developers above all (well.. not above the crappy perf in OS X) was DOCUMENTATION.

Or the lack thereof.

</STRONG>
Uh, WWDC was in May, dude. It's December. :-)

The newest release of the Dev Tolls had a big focus on docs, and a lot of the issues raised at WWDC are supposed to have been addressed. Take a look!
     
Diggory Laycock
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Dec 26, 2001, 10:18 PM
 
great sites for learning cocoa: http://www.cocoadevcentral.com http://www.cocoadev.com - wikki web - (very interesting concept.) http://www.OReilly.com - mac section - learning cocoa (mike beam's column)

Aaron Hilegass's book (haven't actually received my copy yet but heard nothing but good reviews)

Cocoa is a far superior *method* of development compared to older methods (more time solving problems, less time trying to work out how to make the app actually function in a normal fashion.) - But it is just a way of working - you will still need to understand the underlying concepts, methodology and tools of computer science - just using it won't subconciously make you an amazing coder There's hard thinking to be done if you want to code in any language!
     
edddeduck
Mac Elite
Join Date: Mar 2001
Location: London
Status: Offline
Reply With Quote
Dec 26, 2001, 10:38 PM
 
By Diggory Laycock
Aaron Hilegass's book (haven't actually received my copy yet but heard nothing but good reviews)
What book? An IBSN number or link would be nice.

Cheers Edd
     
mrtaber
Dedicated MacNNer
Join Date: Jan 2001
Location: Sacramento, CA, US
Status: Offline
Reply With Quote
Dec 26, 2001, 10:45 PM
 
Just to chip in my two cents... The key is to remember that Cocoa is a framework. That will be a learning experience in itself. Frameworks are collections of objects written for you to use so that you don't have to write them yourself, reinventing the wheel (I oversimplify, but life is short).

As another poster noted, many things can be done with just a few lines of code, because you will be calling objects written for you. It's very nice, once you get over the learning curve, which can be steep for rich frameworks (like Cocoa).

Regardless, I don't think there will be a single one-stop shop for learning what you want to. A single book might help, but I would break it into separate paths:

* Learning Objective-C. This is going to be your native tongue, so learn it and learn it well. Most (if not all) of the Cocoa framework is written in Objective-C, so there will be no time wasted here.

Most resources teaching Objective-C will also introduce you to object-oriented programming. And to use Cocoa and Objective-C, you will need to understand object-oriented programming. Some people take to it like ducks to water; others have a bit more trouble. Just remember that it's not rocket science, it's not voodoo, and it's not a silver bullet. I love OOP, but in solving many types of programming problems, it creates others. But then, reality is always messy

* Learning the Cocoa framework. This probably means working through an "Introduction to Cocoa"-type book and browsing through the Cocoa class documentation available from Apple. You will be excited and amazed at some of what is available ("Wow, cool!"), and, as a beginner, you may also be puzzled at some of the other classes available ("Why would I ever use that?").

Our programming group is just beginning to work with Apple's WebObjects 5.0. We are running into the same types of problems--bright programmers, but they are just learning Java (which is a must for programming in WO), Objective-C (since many native classes in WO are written in it), as well as learning the basics of web-based apps. In fact, the framework is suspiciously similar to Cocoa (many class names begin with "NS" = NextStep). No coincidence there.

Anyway, have fun and keep the faith. Learn to walk before you try to run. You'll be running quicker than you think.

Mark
TiBook 667MHz/512Mb/30Gb/DVD
Macs for work and play; Windows for...work and play. Oh. Never mind. Whatever.
     
gorgonzola
Admin Emeritus
Join Date: Nov 2000
Location: New Yawk
Status: Offline
Reply With Quote
Dec 26, 2001, 10:55 PM
 
Using Cocoa is not like AppleScript. It's not dead-easy, but it's easy in comparison to having to do some things manually. Basically, InterfaceBuilder writes a bunch of the code for you, so you can assemble a good part of your app graphically. Whatever the app actually DOES still has to be written, though.

OOP isn't very simple, it's just that Cocoa and its tools make writing apps easier than the alternative.

Moving this thread to the Developer forum.

[ 12-26-2001: Message edited by: gorgonzola ]
"Do not be too positive about things. You may be in error." (C. F. Lawlor, The Mixicologist)
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 01:20 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,