# C or Java?

• Java
So I have multiple questions regarding these two programming languages.

1. Which is better to learn first?

2. I recently emailed a possible future university asking what languages they teach. In the email he said "Java rafter than C" Now does that mean mostly Java but C included? Or no C at all?

3. Would you go to a university that doesn't teach C?

4. Suppose I graduated from university tomorrow. In your opinion what languages are essential for someone to know to be a 'general' software engineer/developer?

5. What advice can you provide me in both learning to program and preparing for a computer science degree.

6. What should my mathematical ability be? What should I know before I enroll?

7. So far my knowledge of programming consists of the following:
HTML/XHTML
CSS
JavaScript
Batch Programming
Bash Progamming

What route should I take next without learning C or Java. Would qBasic be a good idea?

Thank you for your time :)

Related Programming and Computer Science News on Phys.org
jtbell
Mentor
In the email he said "Java rafter than C" Now does that mean mostly Java but C included? Or no C at all?

Don't stress out over your choice (or some university's choice for you) of first "real" programming language. No matter what language you start with, you'll end up learning new ones regularly as long as you're an active programmer, depending on what sort of work you end up doing.

Your first programming language at university is where you learn the art/craft of programming in general. As you progress through your studies, you'll be exposed to a variety of programming areas, each of which has its own "preferred" language. When you find an area that interests you, you'll naturally focus on the language appropriate to it. The general principles that you learn with your first language will mostly carry over to other languages.

I'm guessing that you're finishing high school now and about to enter university. There's a pretty good chance that 10-15 years after you finish university, you'll be working with something that hasn't even been invented yet.

So I have multiple questions regarding these two programming languages.

1. Which is better to learn first?
First off, I agree with jtbell. Don't worry too much about it. There's no clear cut "best first language" that I can think of. And what languages you learn has a lot to do with where you want to go in your career. So the following is pretty much my opinion. What's best for you might be different.

3. Would you go to a university that doesn't teach C?
Sure, what's important is learning the practice of good programming in general. Like jtbell said, you should be learning languages as you go anyways. Probably a good idea to make sure one of those languages is a good object oriented one to learn that. I certainly wouldn't want to attend a university that didn't teach any OOP.

I do think learning how the computer works at a deep level is important, and C isn't bad for that. Or even better, learn some assembly programming.

4. Suppose I graduated from university tomorrow. In your opinion what languages are essential for someone to know to be a 'general' software engineer/developer?
Well, those that are in demand, I suppose. I know one guy (ok, not a very serious or good programmer, but still) who is employed doing Java and knows only that. I think that's a bad idea since it restricts his possible jobs too much, and a programmer should know more than one. That said, he's employed.

It's subject to opinion, but I would say it's good to learn C, C++, Java and Python, at least. Throwing in a functional language wouldn't hurt to get a different perspective (though I've never seen a job where they wanted a functional language). From what I can see, those account for the majority of serious programming jobs. I'd say C#, but I'm a Linux guy and avoid it as much as possible. However, there do seem to be jobs out there for it.

5. What advice can you provide me in both learning to program and preparing for a computer science degree.
Read books or other information on programming, and get some practice in. Maybe get into helping out in some open source project or something for the experience. Learn by doing.

6. What should my mathematical ability be? What should I know before I enroll?
Just make sure you're not bad with high school level math. They should be teaching you the rest like discrete math, calculus, linear algebra, etc. Would be nice if you got up to basic single variable calculus, but I don't think that's necessary unless you're interested.

7. So far my knowledge of programming consists of the following:
HTML/XHTML
CSS
JavaScript
Batch Programming
Bash Progamming

What route should I take next without learning C or Java. Would qBasic be a good idea?
I personally wouldn't go the qBasic route. If I was learning a first language, I might be tempted to go for Python. Otherwise, perhaps either C++ or Java. I don't really consider HTML/XHTML and CSS "programming", really. Or at least, they're not full (Turing complete) programming languages.

Like I said, this is just my take on it. Hope it helps a bit.

First off, I agree with jtbell. Don't worry too much about it. There's no clear cut "best first language" that I can think of. And what languages you learn has a lot to do with where you want to go in your career. So the following is pretty much my opinion. What's best for you might be different.

Sure, what's important is learning the practice of good programming in general. Like jtbell said, you should be learning languages as you go anyways. Probably a good idea to make sure one of those languages is a good object oriented one to learn that. I certainly wouldn't want to attend a university that didn't teach any OOP.

I do think learning how the computer works at a deep level is important, and C isn't bad for that. Or even better, learn some assembly programming.

Well, those that are in demand, I suppose. I know one guy (ok, not a very serious or good programmer, but still) who is employed doing Java and knows only that. I think that's a bad idea since it restricts his possible jobs too much, and a programmer should know more than one. That said, he's employed.

It's subject to opinion, but I would say it's good to learn C, C++, Java and Python, at least. Throwing in a functional language wouldn't hurt to get a different perspective (though I've never seen a job where they wanted a functional language). From what I can see, those account for the majority of serious programming jobs. I'd say C#, but I'm a Linux guy and avoid it as much as possible. However, there do seem to be jobs out there for it.

Read books or other information on programming, and get some practice in. Maybe get into helping out in some open source project or something for the experience. Learn by doing.

Just make sure you're not bad with high school level math. They should be teaching you the rest like discrete math, calculus, linear algebra, etc. Would be nice if you got up to basic single variable calculus, but I don't think that's necessary unless you're interested.

I personally wouldn't go the qBasic route. If I was learning a first language, I might be tempted to go for Python. Otherwise, perhaps either C++ or Java. I don't really consider HTML/XHTML and CSS "programming", really. Or at least, they're not full (Turing complete) programming languages.

Like I said, this is just my take on it. Hope it helps a bit.

Thank you everyone for taking time to post. I've taken everything into account. :)

Grep, I've heard that HTML/CSS isn't 'real' programming too. The university did say there's an opportunity to learn assembly while doing the course 'Systems Development'. Thank you for making feel better about the whole C thing. I can't imagine them not to teach it but maybe they just focus more on Java. I'm willing to learn more languages :).

I've recently purchased this book called 'How to Design Programs' (free e-book here http://www.htdp.org/) which teach something called 'Racket' http://racket-lang.org/ It's not a real programming language but I heard someone say it's good to learn as a n00b.

Have you or anyone else any thoughts.

Lastly, Python looks interesting is there a particular book I should buy, keeping in mind my limited ability?

thank you again

Last edited by a moderator:
Thank you everyone for taking time to post. I've taken everything into account. :)

Grep, I've heard that HTML/CSS isn't 'real' programming too. The university did say there's an opportunity to learn assembly while doing the course 'Systems Development'. Thank you for making feel better about the whole C thing. I can't imagine them not to teach it but maybe they just focus more on Java. I'm willing to learn more languages :).

I've recently purchased this book called 'How to Design Programs' (free e-book here http://www.htdp.org/) which teach something called 'Racket' http://racket-lang.org/ It's not a real programming language but I heard someone say it's good to learn as a n00b.

Have you or anyone else any thoughts.

Lastly, Python looks interesting is there a particular book I should buy, keeping in mind my limited ability?

thank you again
I should point out (as a friend was saying earlier as we discussed this) that learning programming and learning a programming language are two different things, though related. Just learning a language itself won't make a good programmer, as learning to use a hammer won't really teach you how to build a house. Learning algorithms, data structures (and a lot more) is a big part of it as well. So don't just focus on languages. I've known a number of people who knew a language but knew little about programming.

As for Racket, I've never head of it. Looks like it's a functional language, so might be good to learn to get a feel for that. But I'm not sure I'd start there right off. I'd have to look at it quite a bit more to get a real opinion on it. So far, it looks not too bad. But if you like it, go for it. Might be fun.

I was just going through the Python Tutorial on the main python site:

http://docs.python.org/tutorial/

That'll certainly get you started. Not sure about actual books. I usually much prefer a book to something online, but I don't have any for Python at the moment. Perhaps someone else has a suggestion.

Last edited by a moderator:
I recommend C...

First, because it's very close to assembly language which is very close to how the machine actually works. Second, because the overall concept and syntax are pretty much the basis of (almost) all modern programming languages. Third, because it can be used on just about every computer you will ever find, from micro-controller to super-computer. Fourth, because you can start simple and keep building.

And don't bother with the ++ part until you understand the basics of structured programming, data structures, and pointer manipulation. My experience with trying to help folks you have stumbled into low-level programming without really learning the basics -- especially data pointer manipulation -- indicates that there's some general failures of concept in many CS programs.

Of course, in the future, this will all be done by computers anyway...

C's good for its ubiquity. Once you've learned it, 50+% of all languages are familiar from the first time you see them. That said, there's no reason why you can't learn Java and use the general knowledge from it to learn any C based language. Although I've noticed that it is a trend among Java-first-languagers to crap themselves at the sight of a pointer.

You mentioned Basic. In my opinion, Basic can be good for learning the basic constructs used in all languages, in a simpler way than they are usually presented. Basic is easy in its simple syntax and small set of features. But at the base level, it has functions, iteration, conditional branching, etc just like any other general programming language. Not to be misleading -- it's a good teacher -- but has little other use to a college CS student.

jhae2.718
Gold Member
I like C (book: K&R) and Python a lot. (I picked up a copy of "Learning Python" used for cheap; it's good, and the online docs are great.)

I also think that it is helpful to program on a Linux/BSD platform.

Don't learn BASIC. :yuck:

I also think that it is helpful to program on a Linux/BSD platform.
Second that!! You will need to program on linux to be a good programmer. So install linux right now and learn to work with it.

As for programming languages, I like C more than java, it's deeper. My alltime favorite is Lisp though. It's more of a cult language, but very beautiful

jhae2.718
Gold Member
My alltime favorite is Lisp though. It's more of a cult language, but very beautiful

Mark44
Mentor
My alltime favorite is Lisp though.
LISP == Loads of Irritating Superfluous Parentheses

I bought a Lisp interpreter for the Apple II family back in about 1982. There wasn't much in the way of documentation, and I didn't get what the big deal was about lambda expressions, so I didn't pursue it.

Apparently lambda expressions are important though, as they are present now in .NET Framework.

On the Linux vs Windows thing, you can write code for either OS. The command prompt window (aka "DOS window) is still present in Windows, and you can write console apps that work about the same as they would in Linux, Unix, whatever.

jhae2.718
Gold Member
You can't really hack the OS with Windows, though.

The Windows command prompt is awful; at the very least use Power Shell.

I recommend C...
You do make some good points in favor of C, no question about it.

Second that!! You will need to program on linux to be a good programmer. So install linux right now and learn to work with it.
Though I agree on the suggestion to use Linux, I wouldn't say "You will need to program on linux to be a good programmer". Hey, I've been using Linux for almost 18 years now, and I love it and don't know how Windows programmers stand it. I would agree that Linux can help make you a better programmer, but let's not go overboard.

He's might already use Linux, I think. He did mention he knows some Bash scripting.

LISP == Loads of Irritating Superfluous Parentheses
You took the words right out of my mouth. I've cracked many a joke about wearing out my parentheses keys doing Lisp. It may be great, but I really find the syntax to be highly annoying, and somewhat hard to read.

I do like that comic though.

You can't really hack the OS with Windows, though.

The Windows command prompt is awful; at the very least use Power Shell.
That much is true (on both counts). Well, in the sense that you used the word "hack", anyways. Because in the other sense, you can hack Windows a lot easier than Linux, if you know what I mean.

If forced to use Windows, one of the first things I do is install Cygwin. The "DOS" command shell is awful. Just... awful... :yuck:

jhae2.718
Gold Member
That much is true (on both counts). Well, in the sense that you used the word "hack", anyways. Because in the other sense, you can hack Windows a lot easier than Linux, if you know what I mean.
I generally forget that the popular definition of "hacking" is what I consider cracking. It's quite a shame the way the meaning of hacking was corrupted.

I generally forget that the popular definition of "hacking" is what I consider cracking. It's quite a shame the way the meaning of hacking was corrupted.
Yeah, I know how you feel. I spent years trying to correct people on that, but I've pretty much given up at this point.

Ah well, in memory of the old newsgroup (totally knowing very few people - if any - will get it):

ObHack: The IDE controller in my PC that could do 3D had died, so I made it into a diskless thin client to boot off a really old PC. Individually, each PC was useless, but together, they made one passable PC that could play my games.

ObLanguageComment: Ook! is obviously the best language for a beginner.

jhae2.718
Gold Member
INTERCAL is another good starting language.

INTERCAL is another good starting language.
Malbolge should be a bit easier on beginners.

For example, just printing "Hello world!" only consists of two lines:

('&%:9]!~}|z2Vxwv-,POqponl$Hjig%eB@@>}=<M:9wv6WsU2T|nm-,jcL(I&%$#"
CB]V?Tx<uVtTRpo3NlF.Jh++FdbCBA@?]!~|4XzyTT43Qsqq(Lnmkj"Fhg\${z@>
This is a lot more efficient than other programming languages!!

jhae2.718
Gold Member
Here's a Whitespace program:
Code:

7. So far my knowledge of programming consists of the following:
HTML/XHTML
CSS
JavaScript
Batch Programming
Bash Progamming
As stated before, not really programming languages. I also wouldn't recommend listing them when asked what you know :P

The only thing you learn from those is that programming has very specific syntax, and maybe a couple control structures in batch/bash/js.

I have a bias towards people learning C++ first.

1) It's what I learned first, if only for the reason that 'C++ For Dummies' was the only programming book available at my local bookstore when I was in grade 7.

2) It's a very strict (syntactically) language. This, IMO, builds good coding habits.

3) You have to do things the hard(er) way. This will just make you more appreciative of the 'easier' languages :)

However, in an ideal world people would be learning C++ first... in a classroom. Pointers are hard for people to wrap their heads around and building your first linked list without guidance is a nightmare.

I strongly recommend Python to anyone teaching themselves to program for the first time. It's relatively easy while still being a powerful language, it will be useful for years, and most importantly... There's a huge community supporting it if you need help.

There's almost a religious zeal that seems to come along with being a Python coder and there are innumerable communities and chat channels set up to helping people learn it.

In the long run, it won't really matter what language you learn first. Once you know one, you basically know them all. You just have to learn the quirks and tricks of each one as you need it.