Discussion in 'Mac Programming' started by iWill, Nov 24, 2006.

  1. iWill macrumors member

    Nov 24, 2006
    Sorry Guys about this but as a 15 year old kid i am completely perplex as to how people learn on how to program...
    First of all, living in London i decided this year to take courses or private lessons to learn C++, but no such courses or lessons existed for my age at least...
    So now i am learning with this great book ("C++ a Beginner's Guide" by Herbert Schildt) but as I am gaining more and more knowledge I am now in the need of learning on how to program with a GUI.
    But how? Also, should i consider learning Cocoa or another language?
    P.S. Do any Londonners have any advice as to where i can attend courses about C++ or other languages?
  2. MacBoobsPro macrumors 603


    Jan 10, 2006
  3. HiRez macrumors 603


    Jan 6, 2004
    Western US
    If you want to code applications that will only run on a Mac, then you want to use Cocoa. But, this will require learning and using Objective-C. Since you are learning C++, you might want to consider some cross-platform C++ GUIs, such as Qt (don't confuse this with QuickTime), wxWidgets, or GTK+. Personally, I think Cocoa with Interface Builder is a pretty friendly way to get into GUI programming, but it's not really well-supported with C++.
  4. bronxbomber92 macrumors regular

    Nov 23, 2006
    We sound very similar. I am also your age, and I learned my core knowledge of C++ from that book (which I found to be a great book, by the way ;)). For GUI, I would learn OpenGL. Though it's more geared toward 3D game developers, it's not only used for that purpose. Also, SDL is another cross-platform graphic library. SDL is mainly for 2D library, but can be paired with OpenGL for 3D games. As far as graphic-wise goes, there endless amount of libraries, engines, and APIs to choose from. Cocoa is the best API to use if you want Mac only applications. That too can be used with OpenGL or SDL(I'm unsure about SDL). My advice, go with OpenGL as it's the most widely used. If you were to say you are willing to learn Objective-c(which won't be too hard if you know C/C++) and are only looking to make apps only for a Mac, then i would say go with cocoa most definitely (and use OpenGL for any 3 dimensional needs you have).

    You may want too look here:
    It mostly about all the ways to setup a window.

    Hope that helps:)
  5. Soulstorm macrumors 68000


    Feb 1, 2005
    Please do yourself a favor and buy another book. Herbert schildt is the most useless writer for programming topics ever. He may be in the ANSI/ISO comitee, but that doesn't make hima a writer.

    Don't believe me? Check here He has the worst reviews ever.

    I know this for a fact because I bought his book "Learn C++ from the ground up" and I thought I had a gem in my hands. Later, I bought "The C++ Programming Language Special Edition" and I saw what I was missing. Schildt will not even learn you tha basics, and will introduce bad programming habits. He is known for the bad quality of his books.
  6. iWill thread starter macrumors member

    Nov 24, 2006
    Thanks for the replies everybody. I have to admit though that I am slightly confused thinking that starting C++ might have been a mistake. I guess for a windows GUI i will now need to learn .NET and for mac Cocoa...right?
  7. ironjaw macrumors 6502

    May 23, 2006
    Cold Copenhagen
    No, you made a good choice, C++ is an advantage, albeit difficult to learn it - once it is your core language it is easier to migrate to other languages eg. Obj C, C, .Net, JAVA etc. C++ will take you a long way as there is still need for good quality programmers in that field
  8. bronxbomber92 macrumors regular

    Nov 23, 2006
    Yes, though many say it's a terrible languauge, that only because of the raw power it has. Unlike Java and C# with gargage collecting, you must be a lot more careful about what you do.

    And no, for a GUI in windows there a lot of alternatives. .NET is primarily used for C#, not C++. Though if you wish to learn C# for both Mac OS X and Windows you can use Mono:
    Mono is a free implementation of .NET for all platforms. Though it's not "complete", it's very close to the actual .NET.
  9. Catfish_Man macrumors 68030


    Sep 13, 2001
    Portland, OR
    No, it's also because many people disagree with its focus. It has a triad of goals: type-safety (any error that can be caught at compile time should be), speed (anything slower than C should be optional), and flexibility (it should be able to be used for any problem [see iokit for an example of a subset of C++ in a niche problem domain]). It trades expressiveness and simplicity for these. Some people like that, some people don't.

    Personally, I like the approach of having an easy to write/maintain language with the ability to mix in C (and/or ASM) when needed in a few performance critical inner loops. So I mostly use ObjC :)
  10. iWill thread starter macrumors member

    Nov 24, 2006
    How does ObjC or Cocoa compare with C++?
  11. gnasher729 macrumors P6


    Nov 25, 2005
    Just a word of advice: You may think that you've got a good book, but Mr. Schildt is usually better known under the name "Bullschildt" for good reason. Don't trust anything he says. Never, ever believe that anything is true because Mr. Schildt says so; when in doubt, assume he is wrong.
  12. iWill thread starter macrumors member

    Nov 24, 2006
    Then what should I buy?I based my purchase on what the amazon comments were and this book had excellent reviews...:confused:
  13. savanahrose macrumors 6502a


    Jul 31, 2006
    greer SC
    thank you for the heads up on this guy. I will remember his name due to the little play on his name and bull****.

    Thanks and gl iwill with your learning process.
  14. bronxbomber92 macrumors regular

    Nov 23, 2006
    Cocoa is an API, not a language.Objective-C is ANSI C with OOP added. If your going from C++ to Objective-C you may find it akward at first, but really it's a simple language.
  15. iWill thread starter macrumors member

    Nov 24, 2006
    O ok thanks
    So since Bullschildt :D books aren't so good, what is a must for learning C++?
    Also, when buying a book for Cocoa, does it mean that I have to buy one for ObjC and Cocoa or just one?Which one(s)?
  16. bronxbomber92 macrumors regular

    Nov 23, 2006
    How about the book by the creator himself :)
    Well usually those two are sorta paired together. But yes, if you can afford it, I would buy one for both.
  17. fimac macrumors member

    Jan 18, 2006
    Well said!

    You might be interested in "D" :)

    IMHO it is a nice improvement to C / C++. There is a Mac port available.
  18. bronxbomber92 macrumors regular

    Nov 23, 2006
    Isn't D almost virtully used no where?
  19. fimac macrumors member

    Jan 18, 2006
    Fair point.

    Of course, all great things have to begin somewhere ;)
  20. LtRammstein macrumors 6502a


    Jun 20, 2006
    Denver, CO
    I recommend starting to learn from Java and C++ then move on to more difficult programming types.
  21. lazydog macrumors 6502a

    Sep 3, 2005
    Cramlington, UK
    Hi iWill

    You can stick with C++ and STL for the major part of your project and just mix in Objective C when you need to interface with Cocoa, eg writing handlers for the user interface elements etc. At least that's what I do.

    I guess it's a personal preference but I don't like the reference counting stuff in Objective C and much prefer the memory management in C++. Also I find NSString a pain to use and the calling convention [ … ] for methods confusing and long winded to use. I have no doubt that Cocoa is a very powerful API but when I write programs for the Mac I always end up using the minimum amount of Cocoa and Objective C that I can get away with and use my old favourites C++ and STL for the rest. Anyway the Core stuff in OS X is written in plain C.

    Sticking with C++ and STL or similar will have advantages in the long run if you wan tot make a career out of programming.

    If you are interested in programming 3D then you could learn to program using Glut and OpenGL. This will let you write 3D applications in C or C++ without having to learn any Cocoa or Objective C. As an added bonus if you are careful your programs will compile and run on Windows and Linux with little if any modification.

    Hope this helps

    b e n
  22. iWill thread starter macrumors member

    Nov 24, 2006
    Thanks for the replies much more responsive than on the Apple forums.

    Question, does GUI programming require knowledge on classic console programming?...I mean I'm currently learning C++ and I know that terms such as " cout << " aren't going to be very useful later on.
    I know I'm really clueless when it comes to GUI programming but i fear that all my knowledge won't really be used in the future.
    Right or Wrong?:confused:
  23. Nutter macrumors 6502

    Mar 31, 2005
    London, England
    The things you're learning now will always be useful. Even when you start programming applications with a GUI, you're going to need to know how to print to the console for debugging purposes.

    If you want to get into GUI programming on the Mac, you'll probably want to use Cocoa. That means that you're going to have to learn Objective-C at some point. Don't think you've been wasting your time on C++ though, once you've grasped the concepts involved in programming, learning a new language is actually quite easy. Objective-C is a particularly easy language to learn if you already know a C-based language.

    I'd recommend this book for Objective-C:

    This book may frustrate you a bit because I can tell you're eager to get started on GUI programming, but I would urge you to work through it (or something similar) before you start on Cocoa. Trying to learn Cocoa without a solid grasp of Objective-C first will make your life much harder than it has to be.

Share This Page