Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Oct 30, 2009, 07:03 PM   #1
laur5730
macrumors newbie
 
Join Date: Oct 2009
C and GUI

This is the ultimate noob question, hehe.

I'm currently learning to write C so I can move over to Objective-C.
What I want to ask is, can you make C work with a GUI or do I have to wait with Objective-C and Cocoa?

Thanks in advance

P.S. Another inc noob question.
Is there different on Windows C and Mac C?
laur5730 is offline   0 Reply With Quote
Old Oct 30, 2009, 07:27 PM   #2
Heath
macrumors regular
 
Join Date: Aug 2005
Location: Canada
If your objective is to learn objective c, why not start with that?
Heath is offline   0 Reply With Quote
Old Oct 30, 2009, 08:55 PM   #3
Nordwolf
macrumors newbie
 
Join Date: Oct 2009
> I'm currently learning to write C so I can move over to
> Objective-C. What I want to ask is, can you make C work
> with a GUI or do I have to wait with Objective-C and Cocoa?

If you want to learn Objective-C, then just start out learning Objective-C. You will learn the parts of C that you need to know at the same time. Starting out learning plain C will actually make learning Objective-C somewhat harder because the paradigm shift from procedural based programming to object oriented programming will be a more difficult mental transition for you to make than if you just started off learning Objective-C's system of object oriented programming right away.

You can use Carbon to write a GUI in C on Mac, but I would strongly advise against it. Carbon is deprecated and will no longer be enhanced by Apple.

As far as other options for developing GUI on Mac, yes there are plenty. There are several C++ options such at Qt. There are also other languages such as Python or Java. These would make your app more portable as Objective-C and Cocoa are tied exclusively to Apple for the most part.

> Is there different on Windows C and Mac C?

As far as the language and standard C library, no there is not. But when you start getting into GUI development and such, then yes, the APIs are very different between Mac and Windows. However, if you go with a cross platform toolkit like Qt, you can hide almost all of the underlying API differences so you don't have to worry about them. Again, this will make your programs more portable if you are interested in running them on systems other than Macs.

Hope that gives you some good information to get started with.
Nordwolf is offline   0 Reply With Quote
Old Oct 31, 2009, 04:33 AM   #4
laur5730
Thread Starter
macrumors newbie
 
Join Date: Oct 2009
This is interesting

My goal is to program for Mac/iPhone but mainly the iPhone. My track book reading was something like: Learn C on the Mac (which I should drop now), Learn Objective-C on the Mac, Beginning iPhone 3 Development: Exploring the iPhone SDK (the iPhone track) or Learn Cocoa on the Mac (the Mac track). Is there any book/better track you would take?

But let me hear if I got this right (I'm still new to all this programming)
C is same for Windows and Mac until I play with GUI.
C++ is for Windows mostly/only
Objective-C is for Mac mostly/only.

But if I want to make a GUI for Objective-C (I want to focus on develop for Mac/iPhone as I can see all are doing for Windows = greater audience(you know what I mean )) I should go with Cocoa.

For example, the bot Pocket Gnome. I believe that is written in Objective-C with Cocoa as GUI? There picture is at top right

Thanks in advance again!
laur5730 is offline   0 Reply With Quote
Old Oct 31, 2009, 05:11 AM   #5
GorillaPaws
macrumors 6502a
 
GorillaPaws's Avatar
 
Join Date: Oct 2003
Location: Richmond, VA
Quote:
Originally Posted by laur5730 View Post
Is there any book/better track you would take
I would personally recommend Kochan's "Programming Objective-C 2.0", and then Hillegass's "Cocoa Programming for Mac OS X." Hillegass doesn't cover the iPhone, but it's still a very good foundation to have. I haven't messed with the iPhone yet myself, so I can't make any suggestions as to which book is best for that (I'm sure there's threads on the subject in the iPhone development forum though-- might want to do a search).
__________________
How to ask good programming questions: Getting Answers
GorillaPaws is offline   0 Reply With Quote
Old Oct 31, 2009, 05:23 AM   #6
laur5730
Thread Starter
macrumors newbie
 
Join Date: Oct 2009
Quote:
Originally Posted by GorillaPaws View Post
I would personally recommend Kochan's "Programming Objective-C 2.0", and then Hillegass's "Cocoa Programming for Mac OS X." Hillegass doesn't cover the iPhone, but it's still a very good foundation to have. I haven't messed with the iPhone yet myself, so I can't make any suggestions as to which book is best for that (I'm sure there's threads on the subject in the iPhone development forum though-- might want to do a search).
Thanks, I also heard much about Hillegass, will look more into him.
laur5730 is offline   0 Reply With Quote
Old Oct 31, 2009, 12:43 PM   #7
larkost
macrumors 6502a
 
Join Date: Oct 2007
Quote:
Originally Posted by laur5730 View Post
But let me hear if I got this right (I'm still new to all this programming)
C is same for Windows and Mac until I play with GUI.
With a slight adjustment this is right: The core of C is the same everywhere (Windows, Mac, Linux, embedded, etc..., etc..., etc...). The whole purpose of creating C was so that the phone company (Bell) could develop their software once, then compile it for any vendor's hardware/os combination.

However, most of programming does not use the core of C, but rather builds on libraries of code that others have created. These libraries can be very platform specific, especially ones that are created by OS vendors. Of these the GUI libraries are often the most platform dependent.

Now as others have mentioned, there are third-party GUI libraries that work very hard to make it easy to port back and forth. But they never quite feel native to any one OS (since they have to make compromises).

Quote:
C++ is for Windows mostly/only
Here you have it wrong. C++ is a standard extension of C and is similarly used all over the place, including in MacOS X. Much of the lower levels of MacOS X is written in C++. However, the NeXT company was a big proponent of an alternate way of adding Object Orientation to C, and so helped flesh out Objective-C.

With the systems Apple has in place you can even mix C, Objective-C, and C++ calls into the same file using a '.mm' extension, although you are likely to drive yourself batty doing this too much (because of the weird mix of memory semantics). I should note that by listing 'C' in that list I am being redundant, since Objective-C is a strict superset of C, and C++ is very nearly one too (there is some exception that slips my mind at the moment).

Quote:
Objective-C is for Mac mostly/only.
Technically there are Objective-C compilers that will compile on any target OS, but while Objective-C is a nice language the real draw to using it on MacOS X is the beautiful and extensive library that Apple provides: Cocoa. Without Cocoa and the underlying Foundation (and other) frameworks it would be a waste of time to use Objective-C (the same can be said about any language without libraries). And with two odd exceptions (Cocotron and GNUStep) none of these libraries are available anywhere else than on MacOS X.

So a better statement is that Objective-C is only used to any great degree where the Cocoa or CocoaTouch libraries are available: MacOS X and iPhone OS.
larkost is offline   0 Reply With Quote
Old Oct 31, 2009, 01:20 PM   #8
laur5730
Thread Starter
macrumors newbie
 
Join Date: Oct 2009
Quote:
Originally Posted by larkost View Post
Technically there are Objective-C compilers that will compile on any target OS, but while Objective-C is a nice language the real draw to using it on MacOS X is the beautiful and extensive library that Apple provides: Cocoa. Without Cocoa and the underlying Foundation (and other) frameworks it would be a waste of time to use Objective-C (the same can be said about any language without libraries). And with two odd exceptions (Cocotron and GNUStep) none of these libraries are available anywhere else than on MacOS X.

So a better statement is that Objective-C is only used to any great degree where the Cocoa or CocoaTouch libraries are available: MacOS X and iPhone OS.
Isn't Cocoa the GUI when working with Mac and iPhone?
laur5730 is offline   0 Reply With Quote
Old Oct 31, 2009, 01:22 PM   #9
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
Quote:
Originally Posted by laur5730 View Post
Isn't Cocoa the GUI when working with Mac and iPhone?
Technically it's CocoaTouch, not Cocoa. It shares some concepts and a few classes, but it's different.
robbieduncan is offline   0 Reply With Quote
Old Oct 31, 2009, 01:38 PM   #10
Catfish_Man
macrumors 68030
 
Catfish_Man's Avatar
 
Join Date: Sep 2001
Location: Portland, OR
Send a message via AIM to Catfish_Man
Almost all of Foundation is shared; AppKit is where most of the differences are.
Catfish_Man is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting 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

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Siri GUI is incompatible with SemiTether Jimmy Guphanti Jailbreaks and iOS Hacks 6 Nov 6, 2011 10:30 AM
Begginer GUI Tutorial For C Halfmaster1 Mac Programming 5 Aug 25, 2011 03:47 PM
TV Out and GUI MODDING redchannel Jailbreaks and iOS Hacks 1 Jul 30, 2009 04:42 PM
Looking for iPod 5G dock with video output and GUI KevinAKC iPod 1 Jun 17, 2008 09:45 AM
About Shapeshifter and gui mooshoo Mac Applications and Mac App Store 3 May 19, 2004 12:02 AM


All times are GMT -5. The time now is 09:05 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC