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

Watabou

macrumors 68040
Original poster
Feb 10, 2008
3,426
759
United States
Hey guys,

I have learned Java sufficiently I think and I was maybe hoping to give c, obj-c or c++ a try. Which do you guys think I should start on first? I am majoring in Computer science and right now, I am just learning these on my own time just because programming is so fun and I got nothing else to do besides go to macrumors and post.

And do they have an IDE? When I was learning Java, I used Eclipse as my IDE and I liked that application. Anything similar for C, C++ or Objective C side?

Any helpful hints and tricks would be appreciated as will links to some helpful tutorials on those languages. And I really like the sites that help you from the beginning(as I am a beginner) and not so much those that start randomly somewhere which causes me to get confused.

For example, the way I learned Java was first hello world, then for loops and then all the different kinds of statements like do-while and stuff like that. Then I started to learn object oriented programming and then arrays. I want something similar to those.
 

Littleodie914

macrumors 68000
Jun 9, 2004
1,813
8
Rochester, NY
It's late, so I don't have much for you, but...

There are actually versions of Eclipse for developing in C and C++, and I would definitely recommend them. If you're looking for Objective-C, which is just the lovechild of C and Smalltalk, then you'll want to use the Xcode IDE, which you can download for free from Apple's development website. (Dev Site)

If I were you, I'd skip C. It's pretty terse and doesn't follow more modern aspects of OOP. Start with C++, learn about memory management, and all the spiffy stuff that you don't get to learn in Java. Then, move to Objective-C. If you're looking to develop specifically for Mac applications, definitely check out the third edition of Aaron Hillegass' book, Cocoa Programming for Mac OS X.

Happy coding! :)
 

foidulus

macrumors 6502a
Jan 15, 2007
904
1
If I were you, I'd skip C. It's pretty terse and doesn't follow more modern aspects of OOP. Start with C++, learn about memory management, and all the spiffy stuff that you don't get to learn in Java. Then, move to Objective-C. If you're looking to develop specifically for Mac applications, definitely check out the third edition of Aaron Hillegass' book, Cocoa Programming for Mac OS X.

Happy coding! :)

I would actually recommend that you learn C. You get to do stuff at a much lower level than you do with Java, which is useful for learning how computers actually work, which will help you with languages like Java in the long run.

Plus, C++ is such a bastard language, I would recommend avoiding it unless you have to learn it. C isn't pretty, but its a lot more fun than C++ imo.
 

Watabou

macrumors 68040
Original poster
Feb 10, 2008
3,426
759
United States
Thanks guys. And isn't XCode in the Leopard disks? I think it is so I might just install it from there.

I guess I will start with C++ and then move onto Objective-C and then if I have the time, I'll learn C.

And yes I am interested in developing Mac applications. I see they have the book at Barnes and Nobles and I will pick it up once I am done learning C++. This is the book right: Book Link

Thanks for the help. Any more help/tips? :)
 

Catfish_Man

macrumors 68030
Sep 13, 2001
2,579
2
Portland, OR
Considering C is part of both Objective-C and C++, I don't think you'll have much choice about picking up a good deal of it in the process of learning either of those.
 

Cromulent

macrumors 604
Oct 2, 2006
6,816
1,100
The Land of Hope and Glory
There will come a point when learning Objective-C when you won't be able to understand a particular concept and that will be because a lack of understanding of C. Learn C and you should be able to pick up Objective-C in no time.

Remember that the first language you learn always takes the longest, every language you learn after that takes less and less time. So don't worry that it will add another couple of months onto the time frame.
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
this comes up fairly frequently and my advice is always:
get a text editor, gcc, and K&Rs "The C Programming Language".
Go through tutorials on a site like cprogramming.com.
when you run into trouble post your code and questions here.
once you really know C, you can move on to Objective-C.

If you want to program on OS X it needs to be on Objective-C to interact with the cocoa API. C++ has its merits, but just consider what you will be doing before choosing it or Obj-C. Don't do both at once or you'll never remember what things std::string supports vs NSString, object declaration will get muddled, etc.

If you start with C++ I would still learn C first. I learned C++ before C and it would have been easier to learn both if I had gone in the other direction.

Good luck!

-Lee
 

HiRez

macrumors 603
Jan 6, 2004
6,265
2,630
Western US
I wouldn't start with the K&R book unless you are already a good programmer in another language or languages and have a good low-level general computing understanding. It's a great book but an extremely steep learning curve, not really for beginners IMO.

I don't know what C book would be easier to learn C from, but there are still a ton of them out there and the beauty is that C hasn't really changed significantly for decades, so it's not like modern languages where you need the very latest.

Watabou says he's in a CS program, aren't they teaching C in those nowadays? Or is it all Java?
 

bstreiff

macrumors regular
Feb 14, 2008
215
2
C++ would not be too hard to pick up, coming from Java. Just remember that method calls are not virtual unless you explicitly make them so, and that you have to 'delete' everything you 'new'.

I'd start with C; it's pretty simple, plus it's an almost-subset of C++ and a subset of Objective C.

I learned the language largely by modding Quake 2-- and now the entire engine's open-source, not just the game logic. It might be worth experimenting with; you can start off with a fully-featured codebase, change it, and see what effect your changes had. But maybe that's just me.
 

firewood

macrumors G3
Jul 29, 2003
8,141
1,384
Silicon Valley
If you want to be able to write small, tight, memory and battery conserving code for the coming proliferation of embedded devices, then learn some plain C, and maybe even some assembly language. There are lot's more people who can only write bloated OOP stuff competing for jobs in the market. Some types of projects need that, and some have very different requirements.
 

Cromulent

macrumors 604
Oct 2, 2006
6,816
1,100
The Land of Hope and Glory
If you want to be able to write small, tight, memory and battery conserving code for the coming proliferation of embedded devices, then learn some plain C, and maybe even some assembly language. There are lot's more people who can only write bloated OOP stuff competing for jobs in the market. Some types of projects need that, and some have very different requirements.

I agree. Embedded programming is the next "big thing" in my opinion.
 

yeroen

macrumors 6502a
Mar 8, 2007
944
2
Cambridge, MA
If you're majoring in Computer Science you will need to learn C eventually. C and the C standard library are very close to the operating system, since operating systems themselves are mostly implemented in C. Beyond operating systems, you will also need to know C for courses in compilers, network programming, and real-time and embedded development. The majority of open source code available on Sourceforge is written in C because C is arguably the most portable of compiled languages (compile anywhere, run anywhere...Java achieves this effect in a different way since it is itself a platform). In OS X, the CoreFoundation and Darwin APIs for example are all C APIs.


I'd bypass C++ for now and go straight into pure C. There you can learn all the C constructs and idioms in a simpler, less distracting, more astringent environment. Coming from Java, learning C will mainly be a task of learning how to deal with memory and resource management. Pointers have been and will remain the one stumbling block for all new C programmers, but they are the most idiomatic of C language constructs and mastery of pointers, C arrays, C strings, and memory management is a requirement before moving on to C++.

Once you've gained some proficiency in C, then you can move on to C++. Since you already know Java, it will feel much more familiar and with some knowledge of C you'll be able to burn the candle at both ends, so to speak. It'd be a mistake however to treat C++ as a more unhinged version of Java. Java is a pure OO language whereas C++ is a multiparadim language supporting procedural, OO, and generic programming. Generic programming and templates are the by far one aspect of C++ that has seen the most activity in recent years. People keep finding new and surprising uses for templates in C++ that were never imagined by the language creators. Java 5 has 'generics' but Java generics have a smaller scope and a much smaller impact on the language than do C++ templates (see Java Generics aren't for a discussion).

Objective C is 'orthogonal' to C++. Objective C syntatically adds only a few keywords and constructs to the C language but these effect a radical, profound change. Objective C is a much simpler language than C++ by an order of magnitude. It's very 'Apple-ish' in it's elegance.

As for IDE's, yes there are eclipse/netbeans plugins and Xcode on OS X. But if you're learning C you might as well learn how to work away from an IDE. IDEs are 'culturally' much more prominent in the Java and Windows communities than in the UNIX and C/C++ worlds. IDEs are fine up to a point, but part of the requisite skill set of any budding programmer is knowing how to manage each step of the development workflow individually: design, editing, building, debugging, and revision control. IDEs channel all these tasks into an integrated workflow which has its advantages, but suffers from complexity and lack of portability (just try getting your project out of an IDE).
 

Cromulent

macrumors 604
Oct 2, 2006
6,816
1,100
The Land of Hope and Glory
I disagree. The trend has *always* been away from low level as we've gotten more powerful hardware.

But that is using the first stage of computers as your example. Embedded computing has only just started to get going, there are so many different possibilities with it. Most of which have size as being more important than power.
 

firewood

macrumors G3
Jul 29, 2003
8,141
1,384
Silicon Valley
I disagree. The trend has *always* been away from low level as we've gotten more powerful hardware.

The total number of computer processors which you have in your house/car/business that do not have powerful hardware outnumbers your PC's by probably around a factor of a hundred, perhaps more (one car model has over 300 computers-on-a-chip running it). Even an iPhone has around half a dozen internally. Some run on batteries. These things easily dwarf the total number of servers that even Google and Oracle run.
 

Cromulent

macrumors 604
Oct 2, 2006
6,816
1,100
The Land of Hope and Glory
The total number of computer processors which you have in your house/car/business that do not have powerful hardware outnumbers your PC's by probably around a factor of a hundred, perhaps more (one car model has over 300 computers-on-a-chip running it). Even an iPhone has around half a dozen internally. Some run on batteries. These things easily dwarf the total number of servers that even Google and Oracle run.

Don't forget research into putting chips into humans themselves :).
 

liptonlover

macrumors 6502a
Mar 13, 2008
989
0
I come from a BASIC background and not Java, but I can advise you of one thing. Don't learn C++ to get into cocoa and obj-c.
I recommend http://www.cprogramming.com like someone else mentioned, use that to learn the basics of C. ALL it requires is the basics, you don't need to learn the complications of C++ or anything like that.
Next get hillgasse's book, cocoa programming for mac os x. I know it's not the best book ever, but it works. First of all everyone can relate to it and help you, second it covers a lot of topics. Then just keep google handy and go through that. When you find that you can't understand a topic or want/need to get further into a problem, ask google and get your answers.
 

Watabou

macrumors 68040
Original poster
Feb 10, 2008
3,426
759
United States
Thanks for the help guys.

Yes I guess I will start with C. It will definitely help me build cocoa programs in the log run.

Also, getting away from an IDE will be painful but I will accomplish it. :)
 

Cromulent

macrumors 604
Oct 2, 2006
6,816
1,100
The Land of Hope and Glory
If you have windows, you can get a free version of Visual Studio Express for C++ if you want.

Why when Xcode is free for the Mac and is included on every Mac OS X Install disk?

The reason not to use an IDE is because it incorporates unnecessary complexity when you should be getting on learning the language not the IDE.
 

Farani

macrumors 6502
Oct 21, 2007
267
0
I'm in the process of learning Objective-C and Cocoa right now myself. I've known C++ for years now, and I would have to say that learning C++ isn't all that advantageous to helping you learn Obj-C; rather I find it has been hard to break my mindset of C++ and step into Obj-C. Obj-C seems to be much more object oriented, in a way that C++ isn't. Take that with a grain of salt, though, I'm still learning Obj-C. Just my 2 cents...
 

liptonlover

macrumors 6502a
Mar 13, 2008
989
0
I tried learning objective C and cocoa without learning C first because I really didn't like the idea of learning another language just to learn what I really wanted. But with cprogramming.com (which by the way hasn't been updated since 2003) I learned enough of C to get started, though apparently I need to go back and learn more lol.
So probably do more than skimming over C like I did, but don't get into its depths. I can't write an app in C, but I understand how it works. I can do loops, if statements, I can declare variables and structs, all the basics.
 

Cromulent

macrumors 604
Oct 2, 2006
6,816
1,100
The Land of Hope and Glory
So probably do more than skimming over C like I did, but don't get into its depths. I can't write an app in C, but I understand how it works. I can do loops, if statements, I can declare variables and structs, all the basics.

The problem is Objective-C makes use of pointers which require an understanding of C. Seeing as Objective-C is basically C with some nice things on top, learning C is learning Objective-C at the same time as C is a proper subset of Objective-C.
 

Watabou

macrumors 68040
Original poster
Feb 10, 2008
3,426
759
United States
The reason not to use an IDE is because it incorporates unnecessary complexity when you should be getting on learning the language not the IDE.

True. I was extremely dependent on IDEs when i was learning Java.
When I had to take the AP Exam, I had to do it without an IDE and just on paper. It was kinda hard to study before the AP exam because I had to remember all the syntaxes. The IDE just took care of them and I would basically forget about it.

HiRez said:
Watabou says he's in a CS program, aren't they teaching C in those nowadays? Or is it all Java?

Well no really. I was learning java in a computer science class because well...it was just Java.

yeroen said:
I'd bypass C++ for now and go straight into pure C. There you can learn all the C constructs and idioms in a simpler, less distracting, more astringent environment. Coming from Java, learning C will mainly be a task of learning how to deal with memory and resource management. Pointers have been and will remain the one stumbling block for all new C programmers, but they are the most idiomatic of C language constructs and mastery of pointers, C arrays, C strings, and memory management is a requirement before moving on to C++.

Thanks very much! :)

As you said, I will be leaning away from an IDE. I don't want to get too much into it. And yeah I will go into C first. If all those is a requirement for C++ then I will go to the C route. Thanks again.

liptonlover said:
I come from a BASIC background and not Java, but I can advise you of one thing. Don't learn C++ to get into cocoa and obj-c.
I recommend http://www.cprogramming.com like someone else mentioned, use that to learn the basics of C. ALL it requires is the basics, you don't need to learn the complications of C++ or anything like that.
Next get hillgasse's book, cocoa programming for mac os x. I know it's not the best book ever, but it works. First of all everyone can relate to it and help you, second it covers a lot of topics. Then just keep google handy and go through that. When you find that you can't understand a topic or want/need to get further into a problem, ask google and get your answers.

Thanks for the website! That is just the website I was looking for.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.