Cocoa Programming with NO Experience

Jump to First Reply
Posted:
in macOS edited January 2014
I want to learn how to make Cocoa Programs, and I have no experience beyond AppleScript... help me out here, there are books out, no?





anybody? I want to learn how to just do it, as I can do AppleScript now of when I know that I want to make this happen, I do something... I want to be at that level, and I learned to be at that level when I was twelve, SO I am hoping I learn Cocoa in a similar fashion of not having a class or anything but reading a book or two.... anyoney?
«1

Comments

  • Reply 1 of 37
    chuckerchucker Posts: 5,089member
    Yeah, well, go search for "Cocoa" on Amazon and you'll find a few books.
     0Likes 0Dislikes 0Informatives
  • Reply 2 of 37
    I'd be interested in some recommendations, myself; I have just about as much experience as Nebagakid.



    Thanks
     0Likes 0Dislikes 0Informatives
  • Reply 3 of 37
    I was told you should really know a lot of C++ before you even start attempting to do Cocoa (or Carbon) programming. Is this true?
     0Likes 0Dislikes 0Informatives
  • Reply 4 of 37
    mcqmcq Posts: 1,543member
    I think Carbon is C++ based, so knowledge of C++ would be extremely useful. As far as Cocoa, it's Objective-C, which is object oriented so knowledge of either C++ or Java will be useful as far as understanding the basic concepts. The syntax of Obj-C is a little different, so it takes a little getting used to at first.
     0Likes 0Dislikes 0Informatives
  • Reply 5 of 37
    applenutapplenut Posts: 5,768member
    [quote]Originally posted by TigerWoods99:

    <strong>I was told you should really know a lot of C++ before you even start attempting to do Cocoa (or Carbon) programming. Is this true?</strong><hr></blockquote>



    ive heard the opposite that C++ will just create bad habits and methods and ways of thinking that are only going to cause problems as you transition to objective c which cocoa uses
     0Likes 0Dislikes 0Informatives
  • Reply 6 of 37
    Yeah. Objective C is a much different language, in my opinion better. It is different conceptually as well, it allows a lot more to be done on the fly, such as generating functions dynamically. Knowing multiple languages is a good thing. Cocoa is the better develeopment enviroment. Carbon is used as a stopgap in the transition from OS &lt; 10 to OS 10. It is mostly for porting code.
     0Likes 0Dislikes 0Informatives
  • Reply 7 of 37
    kickahakickaha Posts: 8,760member
    As much as I'd love to agree with you Rick, it's not quite that simple. Carbon and Cocoa can (and often *must*... QuickTime is an example of Carbon only code) co-exist in your app, just like Objective-C and C++ can co-exist in your code. (In fact, that's how you mix Carbon and Cocoa - use the proper language for the proper API.)



    Personally, I *vastly* prefer Obj-C, and think that C++ will indeed do more to ruin your OO thinking than help it, but C++ has its place in Mac programming, and god knows it is considered a 'must' for a resume bullet point.



    If you're looking to learn *Mac* programming, or *object-oriented* programming, try and wrap your brain around Obj-C first. It's the primary language you'll use if you want to go the Cocoa route, and it provides a much cleaner and more pure form of OO. You can spend your time learning the *concepts*, instead of the *language*, like you will with C++. (C++ is a huge morass of a language, trying to be everything to everyone and accomplishing most of it at least adequately, but none of it spectacularily.)



    Then, once you have a good solid idea of what OO is all about, you can hop over to the C++ world and find out all the ways to pull your hair out trying to determine how to get around limitations in the language. (Okay, it's not that bad... but it does feel like coding with one brain hemisphere tied behind your back after Obj-C.)



    If, however, you're looking to add a bullet point to your resume, go the C++ route. Then, in a couple of months when you've figured it out, dive into Obj-C.
     0Likes 0Dislikes 0Informatives
  • Reply 8 of 37
    [quote]Originally posted by Kickaha:

    <strong>

    If, however, you're looking to add a bullet point to your resume, go the C++ route. Then, in a couple of months when you've figured it out, dive into Obj-C.

    </strong><hr></blockquote>



    I wheel this comment out every time someone asks this so here I go again:



    Don't learn C++.



    If you have to ask, you don't need or want to learn it.



    If you are wanting a bullet point, learn java (and/or its evil twin C#).



    Then, in a few years, when you know what's what and you decide you really need C++, you can learn it easily (relatively!) by applying all your Obj-C and Java knowledge. Note: this day may never come.



    Just doing my bit to ensure new programmers aren't put off by starting with one of the hardest to learn languages and getting very little, if any, benefit for their trouble.
     0Likes 0Dislikes 0Informatives
  • Reply 9 of 37
    ast3r3xast3r3x Posts: 5,012member
    i havn't gotten into advanced programming into either, but JavaScript and C++ seem almost idnetical, alot of the same ideas and stuff is done the same way, only minor differences.



    how different is java from javascript?
     0Likes 0Dislikes 0Informatives
  • Reply 10 of 37
    chuckerchucker Posts: 5,089member
    JavaScript, also known as LiveScript or ECMAscript, was only named like that for marketing reasons (it was the beginning of the Java hype). Although it syntax may seem similar to that of Java (and as such, to that of C++), it simply isn't a programming language, but a client-side scripting language.
     0Likes 0Dislikes 0Informatives
  • Reply 11 of 37
    airslufairsluf Posts: 1,861member
     0Likes 0Dislikes 0Informatives
  • Reply 12 of 37
    ibrowseibrowse Posts: 1,749member
    Get Learning Cocoa with Objective-C by James Duncan Davidson, he works for Apple, and it's one of those O REILLY books with the dogs on it. It's a good book.
     0Likes 0Dislikes 0Informatives
  • Reply 13 of 37
    [quote]Originally posted by iBrowse:

    <strong>Get Learning Cocoa with Objective-C by James Duncan Davidson, he works for Apple, and it's one of those O REILLY books with the dogs on it. It's a good book.</strong><hr></blockquote>



    Are you sure he works for Apple? I knew he had left Sun and was a big fan of Apple products but I hadn't heard about Apple hiring him.



    Anyway, that wasn't my main point, this was: this book is the second edition of Learning Cocoa. The first edition was rushed out and sucked big time. It was basically a rehash of Apple's online developer documentation.



    This is technically the second edition but it has a new author and a slightly expanded title and is much better (or so I've heard, I only bought the 1st edition, grrr, but I have a lot of respect for Davidson and O'reilly is generally a very, very good publisher).



    check out the o'reilly macdevcenter for sample articles, including some by the author of this book.

    <a href="http://www.macdevcenter.com"; target="_blank">http://www.macdevcenter.com</a>;



    the programming in cocoa series

    <a href="http://www.macdevcenter.com/pub/ct/37"; target="_blank">http://www.macdevcenter.com/pub/ct/37</a>;



    james duncan davidson stuff (including a sample chapter from his Cocoa book

    <a href="http://www.oreillynet.com/pub/au/151"; target="_blank">http://www.oreillynet.com/pub/au/151</a>;



    [ 01-20-2003: Message edited by: stupider...likeafox ]</p>
     0Likes 0Dislikes 0Informatives
  • Reply 14 of 37
    I would be interested in hearing how PHP compares to other "real" programming languages.



    I have been writing PHP for a couple years now (self-taught and not full time) and have a very good grasp of the NON-OOP side of that fence. I have played around with OOP in PHP and comprehend and have applied it, but am lacking a good global view of the benefits it will get me and keep falling back to my non-oop style (I forget the proper term for this).



    I am interested in getting more into non-web programming.
     0Likes 0Dislikes 0Informatives
  • Reply 15 of 37
    rogue27rogue27 Posts: 607member
    Replies to bits and pieces of the conversations above:



    I believe non OOP programming is called "procedural"



    I believe the object oriented concepts make much more sense and are much better implemented in ObjC than in Java or C++.



    PHP will give you enough of a foundation in programming that you could probably pick up Cocoa and ObjC without too much trouble.



    If you want to learn to make applications for Mac OS X, use Cocoa and learn it from the book "Cocoa Programming for Mac OS X" by Aaron Hillegass.



    Do not worry about Java, C++, or Carbon at first. Just learn Obj C and Cocoa. After you have a good handle on that and have a few small applications under your belt, you may wish to expand your skills and learn the other things, but you have to stay focused on one thing in the beginning.



    If you have little or not programming experience, an online course or tutorial introduction to Java or C++ will help to get you familar with basic programming and OO concepts.



    When learning something like this, experiement a lot.
     0Likes 0Dislikes 0Informatives
  • Reply 16 of 37
    bungebunge Posts: 7,329member
    Anyone have any thoughts on REALbasic, at least as a starter OO language?
     0Likes 0Dislikes 0Informatives
  • Reply 17 of 37
    amorphamorph Posts: 7,112member
    I'll just drive home the point that you should not learn C++ until you've learned programming. Objective-C is a much better place to start with that. I've heard very good things about O'Reilly's Learning Cocoa- the second edition, at least. Hillegas' book is good if you're already a programmer. AppleScript Studio is actually a Cocoa programming environment built around AppleScript, which has OO capabilities. You can write parts (and rewrite parts) in Objective-C as necessary. That might be a good place to start. I can't recall it right now, but there's at least one book forthcoming on AppleScript Studio, and there are lots and lots of excellent resources for AppleScript. You can start at <a href="http://www.apple.com/applescript/"; target="_blank">Apple's page</a>. Python is another easy-to-learn OO language with a bridge to Cocoa, and it ships with OS X.



    AppleScript and Python are well-known as scripting languages, as JavaScript is, but nothing requires an OO language to be compiled to be "serious" or a good way to learn. Python in particular has been proven to scale nicely up nicely to millions of lines of code, but even if it didn't it would be a good place to start.



    I haven't seen RealBasic, so I can't give a concrete recommendation, but pretty much everything is better than C++ as far as learning OO. Once you're a fluent programmer - which is more or less irrelevant to any particular language - then you can become a good C++ programmer. And believe me, the world needs them.



    Just as a clarification, there are several different kinds of non-OO language (and several different kinds of OO). Procedural languages include C, Pascal, FORTRAN and old-school BASIC. There are also declarative languages, whose goal is to be able to solve a problem by stating the problem in code. Examples include PROLOG, ML, Mercury and Miranda. Very few languages are pure examples of a particular style: There are declarative languages with OO capabilities, OO languages with procedural capabilities (C++ and Objective-C) - C can even look vaguely declarative under certain circumstances, as a result of its expression evaluation syntax.



    Actually, one of the many problems with C++ is that it was designed by commitee - it tries to do everything. It even acquired a half-hearted message-dispatch ability as a nod to Objective-C. It doesn't enforce any particular style or paradigm even tentatively, so you have to be disciplined enough to impose one on it, or you'll probably end up writing unreadable gibberish. There's a lot of that out there.



    [ 01-20-2003: Message edited by: Amorph ]</p>
     0Likes 0Dislikes 0Informatives
  • Reply 18 of 37
    bungebunge Posts: 7,329member
    I've been frustrated by OOP for such a long time. I was a very good procedural programmer in college but I haven't been able to make the switch to OOP on my own. I've bought books, read things online, I own REALbasic and have read the tutorials. There's just something missing.
     0Likes 0Dislikes 0Informatives
  • Reply 19 of 37
    ibrowseibrowse Posts: 1,749member
    [quote]Originally posted by stupider...likeafox:

    <strong>Are you sure he works for Apple? I knew he had left Sun and was a big fan of Apple products but I hadn't heard about Apple hiring him.</strong><hr></blockquote>



    My mistake, sorry. From the back of the book,



    [quote]Originally written by insiders at Apple Computer Inc., and revised for this new edition by James Duncan Davidson, this book... <hr></blockquote>
     0Likes 0Dislikes 0Informatives
  • Reply 20 of 37
    [quote]Originally posted by bunge:

    <strong>I was a very good procedural programmer in college but I haven't been able to make the switch to OOP on my own.</strong><hr></blockquote>



    You'd be amazed how many people think they are OO programmers because they use Java or C++. Keep trying--when the penny drops you really do think, "wow, so that's what everyone was talking about".



    I could recommend a list of books but you say you've tried that. In that case I would recommend trying test-first programming using JUnit (or language-specific alternative) and the technique of refactoring.



    Both these techniques evolve your code towards taking full advantage of OO goodness.



    read more at:



    <a href="http://www.junit.org"; target="_blank">http://www.junit.org</a>;

    <a href="http://www.refactoring.com"; target="_blank">http://www.refactoring.com</a>; (the book rocks)



    Also anyone who calls themselves a programmer should have read the pragmatic programmer by Andy Hunt and Dave Thomas.



    Best. Programming. Book. Ever.



    <a href="http://www.pragmaticprogrammer.com/ppbook/"; target="_blank">http://www.pragmaticprogrammer.com/ppbook/</a>;



    PS not to diss RealBasic but if you're learning for your own edification, rather than to get a specific job done, I'd stick to Java as it hits the right mix of mainstream acceptance, ease of use and support for OO.



    Obj-C and Cocoa are cool too, and if you've got a procedural background you can explore both at the same time. Remember that Java looks like C++ but it thinks like Obj-C.
     0Likes 0Dislikes 0Informatives
Sign In or Register to comment.