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 > Developer Center > Learning C vs. Java--Help

Learning C vs. Java--Help
Thread Tools
Forum Regular
Join Date: Nov 2000
Location: Boston Area,ma
Status: Offline
Reply With Quote
Oct 17, 2001, 10:34 PM
 
I have a chance to take some free courses. I'm wondering,if I want to put my new found knowledge to use on OSX, should I learn C or JAVA to begin with.

I'm basically completely new to programming with just a little PHP experience.

Thanks for the advice from experts.

-R
OSX ...Plastic surgery for unix
Boston Area Consulting
http://rjhcc.dyndns.biz
http://bostonmacosx.dyndns.org
     
Mac Enthusiast
Join Date: Sep 2001
Location: McKinney, TX
Status: Offline
Reply With Quote
Oct 18, 2001, 12:55 PM
 
Originally posted by BostonMACOSX:
<STRONG>I have a chance to take some free courses. I'm wondering,if I want to put my new found knowledge to use on OSX, should I learn C or JAVA to begin with.

I'm basically completely new to programming with just a little PHP experience.

Thanks for the advice from experts.

-R</STRONG>
The only reason for taking a C course with respect to OS X would be to learn the syntax so you could progress on to Objective-C. Java would probably be a better choice because 1) the syntax is not all that different from C and 2) it's object-oriented. #2 is important because the Cocoa and Java frameworks are built around object-oriented design (OOD) principles. Once you have OOD figured out, it should be a fairly simple matter to translate your Java knowledge to Objective-C.
     
Forum Regular
Join Date: Aug 2001
Location: Vienna, Austria
Status: Offline
Reply With Quote
Oct 18, 2001, 01:25 PM
 
I think you can't learn Java without knowing C. But that's only my POV.
     
tie
Professional Poster
Join Date: Feb 2001
Status: Offline
Reply With Quote
Oct 18, 2001, 01:36 PM
 
Originally posted by amonitzer:
<STRONG>I think you can't learn Java without knowing C. But that's only my POV.</STRONG>
Exactly. So take the Java class: you'll learn two languages in one.
The 4 o'clock train will be a bus.
It will depart at 20 minutes to 5.
     
Junior Member
Join Date: Mar 2001
Status: Offline
Reply With Quote
Oct 18, 2001, 02:30 PM
 
That's pretty silly. There's a ton in C that isn't in Java. For example:

MEMORY HANDLING! You have to handle your own memory in C. Java's garbage collector makes that unnecessary.
Pointers. C's got them, you need them, Java doesn't have them.
Function pointers. Important to know in C, not available in Java.
String handling. A bear in C (but awfully fast), completely different in Java.
Pointer arithmetic. A powerful C tool, unavailable in Java.
The preprocessor. Powerful and in C only.
Unions. C only, again.
Bit arrays. Only in C.
Variadic functions, only in C.

The list goes on, I'm sure.

-Peter
     
Mac Elite
Join Date: Jan 2001
Location: New York
Status: Offline
Reply With Quote
Oct 18, 2001, 04:23 PM
 
Originally posted by Wixar:
<STRONG>That's pretty silly. There's a ton in C that isn't in Java. For example:

MEMORY HANDLING! You have to handle your own memory in C. Java's garbage collector makes that unnecessary.
Pointers. C's got them, you need them, Java doesn't have them.
Function pointers. Important to know in C, not available in Java.
String handling. A bear in C (but awfully fast), completely different in Java.
Pointer arithmetic. A powerful C tool, unavailable in Java.
The preprocessor. Powerful and in C only.
Unions. C only, again.
Bit arrays. Only in C.
Variadic functions, only in C.

The list goes on, I'm sure.

-Peter</STRONG>
Typical C programmer, loves to do things the hard way, and wants others to do the same.
     
Junior Member
Join Date: Apr 2001
Location: Sunnyvale, CA
Status: Offline
Reply With Quote
Oct 18, 2001, 08:51 PM
 
Originally posted by tie:
<STRONG>
So take the Java class: you'll learn two languages in one.</STRONG>
True, but learn C, and you've practically learned them all.

Most languages out there now days, at least syntactically, are based on C. So, once you learn to code well in C, you've learned just about all languages commonly in use today (e.g. Java, Objective-C, C++, PHP, etc).

It's easier for a C programmer to learn Java, than it is for a Java programmer to learn C. For an example, if you could do a linked list in C, you could do one in Java fairly easily even if you had no prior knowledge of the language; the opposite most likely is not true.
Once you've learned the "hard way", you could still do things the "easy way", but could always do it the "hard way" if you had to. Obviously, the opposite is not true.

So, my suggestion would be: learn C, it's a better long term investment.
     
Addicted to MacNN
Join Date: May 2001
Location: Cupertino, CA
Status: Offline
Reply With Quote
Oct 18, 2001, 09:40 PM
 
Originally posted by amonitzer:
<STRONG>I think you can't learn Java without knowing C. But that's only my POV.</STRONG>
Huh? Java is quite a bit easier to learn than C in my humble opinion. The object oriented concepts might be a little difficult for a beginner but they'll apply across to other programming languages later anyway. The syntax in java is basically just simplified C syntax plus you never have to worry about pointers, memory handling, or C's more difficult string handling and you get a huge library right at your fingertips.

I'd recommend learning java first just to get the hang of programming and the syntax. It's really an excellent language to use when learning how to program. After that, learn C. C really just adds a couple new concepts on top of what you should know from Java anyway.... And if you just want one more reason, most of the really good CS programs at universities in the U.S. teach java first now. The fact of the matter is that if you're trying to really learn programming, there's absolutely no reason to start with the more difficult language. Learn the important easier ones, then move on.

[ 10-18-2001: Message edited by: itai195 ]
     
Dedicated MacNNer
Join Date: Sep 2000
Location: Brisbane, Queensland, Australia
Status: Offline
Reply With Quote
Oct 19, 2001, 07:11 AM
 
I'd learn C first because it gives you an understanding of how many derivateives of C (eg. Java) function when they compile code. If you don't understand how a line of code is compiled (from an abstract pov) then you will probably get lost trying to work with java and many other OO languages, such as objective-c (which you definately need to know C first with, and maybe even c++ or java). C is a good basis for these languages.
     
Senior User
Join Date: Feb 2001
Location: Rochester, uk
Status: Offline
Reply With Quote
Oct 19, 2001, 08:28 AM
 
Wow. Looks like a big pot of lobsters that I'm about to jump into. Here goes...

Every good programming language now is derived from C.
Scripting languages don't count, and nothing in the Basic tradition is any good, so that statement is basically true. Even PHP is as much about C as it is Perl. Once you've learned C, you'll understand where all the other languages came from.

Java takes lessons from lots of other languages.
C++ tried some pretty ambitious things and ended up in a nice big mess, while Java succeeded. Objective-C is beautiful but the syntax is wierd, where Java's makes sense. SmallTalk is obviously the root of Java's principles, if not of any syntax. Java is a derivative not only of C, but of everything C-derived and a few other things besides.

If you learn two languages, you'll be better at both of them.
I've particularly noticed, people with no other background at all often forget how the memory management in Java really works - and how it can affect performance.

I'm not suggesting you write device drivers or anythng. But if you learn the basics of C followed by Java, you'll have an understanding of how programming languages work - and learning Java or any other language will be easier as a result.
All words are lies. Including these ones.
     
Junior Member
Join Date: Mar 2001
Status: Offline
Reply With Quote
Oct 21, 2001, 03:24 AM
 
Originally posted by davecom:
<STRONG>

Typical C programmer, loves to do things the hard way, and wants others to do the same.</STRONG>
I was not suggesting that C is a better language than Java because of those differences I mentioned. I was just pointing out that there's a lot in C that isn't in Java, so that knowledge of Java does not imply knowledge of C.

And if you had to use a lot of Java apps under OS X, you'd be wanting programmers to "do things the hard way" too.

-Peter
     
Dedicated MacNNer
Join Date: May 2001
Location: Sierra Nevada Country
Status: Offline
Reply With Quote
Oct 21, 2001, 02:45 PM
 
Well, the catch here that nobody is really hitting on, is which language is easier to learn for the novice programmer, and I say it's Java hands-down.
When Sun designed Java, they took all the things they hated about C and C++ and got rid of them (at least at the implementation level, they're still there).
I Java you don't have to worry too much about memory management, pointers, scope resolution, macro guards, namespaces, etc... basically everything in C and C++ that makes the language a real b*tch to learn.
I took a Java course last semester (which is our school's introductory programming course, unless you want to take Visual Basic), and I was able to catch on to it in a fairly short time (about 3 weeks). I'm now into my 8th week of my advanced programming course (C++) and it's still difficult to make sense of (and I got an A in Java).
I really think Java is a good language to get your feet wet in, and then you can get into the nitty-gritty of C/Obj-C and C++ and learn the intricacies of the language that you were able to ignore in Java.
That's just my opinion though, your mileage my vary
g.
First there was man, then there was Macintosh
     
Mac Elite
Join Date: Jan 2001
Location: New York
Status: Offline
Reply With Quote
Oct 21, 2001, 06:13 PM
 
Originally posted by Wixar:
<STRONG>

I was not suggesting that C is a better language than Java because of those differences I mentioned. I was just pointing out that there's a lot in C that isn't in Java, so that knowledge of Java does not imply knowledge of C.

And if you had to use a lot of Java apps under OS X, you'd be wanting programmers to "do things the hard way" too.

-Peter</STRONG>
I know, but I don't think this guy wants to develop Photoshop, he just wants to learn a language, and Java is easier to learn. Plus ACM Journal says people learning to program nowadays should learn an object-oriented language first, since going from procedural to object oriented will give you a tendency to try to do things the procedural way. Very good article, also check out the Dr. Dobb's Journal article about why Hello World should be taught in a more object oriented method in Java.
     
Addicted to MacNN
Join Date: Feb 2001
Location: zurich, switzerland
Status: Offline
Reply With Quote
Oct 26, 2001, 11:12 PM
 
The first language I learnt was Pascal about 20 years ago and the first programme I wrote was typed onto punch cards on a IBM treminal. I've learned a bit of Java and C and VisualBasic since then, and started reading the intro to ObjC in the Dev docs.(whose syntax is derived from Smalltalk). I can say with a certainty that Java is the best specified and most consistent language, which translates into ease of learning and is probably the best starter language as there are so many books and IDEs etc to choose from. But , and this is a big but, it depends on where you want to go. If you have a desire to code stuff for the Mac in the future I would learn C as you'll need it to understand pointers and memory handling which comes along in ObjC. Java is simply too slow on the Mac , at the moment in any case, to make any worthwhile GUI stuff and the differences in Java and ObjC syntax are big enough to hinder you IMO. C will also prime you for the nastier bits of Mac programming called Carbon which is done in C/C++ and is a lot more complex than Cocoa/ObjC. If however you are going to be looking for a job as a coder for web stuff or for handhelds in the future then learn Java as java is huge in web development and is coming of age on handhelds with hardware that can directly execute Bytecode. If you are interested in mainly doing stuff like PHP then C will seem closer to that at first in terms of syntax and has the exellent value of forcing you to think when you code. The comments made above on sloppy Java coding become very obvious in larger applications and is sometimes a direct result of the coder not understanding what is happening with massive object creation etc.

Good luck.
weird wabbit
     
Mac Elite
Join Date: Mar 2001
Status: Offline
Reply With Quote
Oct 29, 2001, 08:24 PM
 
I'll go the path not traveled:
1. open up the newspaper
2. look at some jobs that you'd take if you knew [insert language here]

Congratulations, now go have some jfun learning Java.

I'm not saying one language is "better" than another - I don't know enough of either one to say that. Most people wanna make some money. Why not learn a relatively easy language to learn, make some money at it and pay the bills. Then have your company pay for MS in CS and learn deadly hard languages and then worry about writing Photoshop or Mac OS X. One of the biggest drawbacks to learning anything is that when a novice hits a wall, their enthusiasm and drive to learn goes straight down. Who cares about pointers, memory management right now? Learn that stuff when you have a good high level of understanding and when you get the big picture. Then go find something more difficult to learn. Hopefully while you're doing all this, you'll be making enough $$ to put some aside for your future advanced education.

If one language was clearly better than the other then everyone would be using it.

The reason they teach Java in the beginning of your college career is if they threw C at you, all the people would fail and switch to a Communications major and we'd have no developers. They don't teach time dialation until the end of most physics courses, after you know about f=ma, e-mc^2 and the like. Little steps.

Happy Coding.
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Oct 30, 2001, 02:05 PM
 
Originally posted by Raman:
<STRONG>The reason they teach Java in the beginning of your college career is if they threw C at you, all the people would fail and switch to a Communications major and we'd have no developers.</STRONG>
Funny, I don't remember that happening when they used to teach C/C++ in Colleges
     
Clinically Insane
Join Date: Nov 1999
Status: Offline
Reply With Quote
Oct 31, 2001, 10:20 AM
 
I would take C myself. The reason for this isn't because of any inherent superiority. Rather, I suggest it because many languages, including Java, could be considered "descendants" of C. They borrow many ideas, including syntax, concepts, and other nice stuff. So once you know C, you'll be able to use that knowledge to learn many other languages more easily (you can never know too many languages, after all).

In short, learn C and then use it as a jumping-off point for learning other languages like C++, Objective-C, Java, Perl, and so on.
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
     
Forum Regular
Join Date: Oct 2000
Status: Offline
Reply With Quote
Nov 1, 2001, 02:48 PM
 
Might I remind you that both Stanford and USC (both excellent programs, btw) teach straight C for their "101" or equivalent course. Java is later.
     
   
Thread Tools
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 12:29 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2