What to Learn 1st?

getoffb

Member
Jun 19, 2003
36
0
0
I want to start to learn to program. So what language should I learn first?

Some people say to learn Java, others say that C++ is better to learn to first.

Any opinions out there?
 

boran

Golden Member
Jun 17, 2001
1,526
0
76
Well, I'll tell you what I sait do my buddy:

Java pro:
- Designed to be easily learned
- a lot of "out of the box" functionality
- platform independent.
- Really good for Object Oriented programming.

Java con:
- Sometimes fnicky when big upgrades are happening, functions get deprecated, which means you'll might have to rewrite some code two to three years later when they change all fucntionality from one object to another for instance.
- needs a sun compatible JRE installed on the client machine. (so NOT the MS java)
- slower than other languages because of the virtual machine implementation.

C++ pro:
- immediate availability of applications, without the need of a runtime enviroment.
- more versatile, since it is not limited by the VM.
- faster than java.

C++ con:
- not platform independent, apps written for one platform might not work on another.
- somewhat harder to learn than Java

imho, if you got the time for it (say 2 to 3 years) learn both.
 

ClueLis

Platinum Member
Jul 2, 2003
2,269
0
0
Originally posted by: boran
imho, if you got the time for it (say 2 to 3 years) learn both.

For the most part, once you've learned one, the other is easy.

Personally, I would start with Java, as is will get you in the habit of using strictly object-oriented programming. Once you get better, you can start working with C++ and you'll then appreciate all the shortcuts available.
 

boran

Golden Member
Jun 17, 2001
1,526
0
76
Originally posted by: ClueLis
Originally posted by: boran
imho, if you got the time for it (say 2 to 3 years) learn both.

For the most part, once you've learned one, the other is easy.

Personally, I would start with Java, as is will get you in the habit of using strictly object-oriented programming. Once you get better, you can start working with C++ and you'll then appreciate all the shortcuts available.

agreed that they're very close, but it's best to learn all ins and outs, which will take you at least a year or two for java, and then learn C++ which might take another year, I'm just kinda quoting the way they teach it in school here ;) I'm doing the second time the first year of java (flunked last year) and my understanding of the language as a whole is like increddibly higher, so I'd think two years is a minimum to really understand the whole tought process of java and OO programming.
 

amdskip

Lifer
Jan 6, 2001
22,530
13
81
I had an intro in HS of C++ and now in college I'm doing Java. I'd say just pick one and go with it.
 

Jzero

Lifer
Oct 10, 1999
18,834
1
0
I wish I had learned C++ first. I was taught Java first, and when I went to learn C++ I was very discouraged by all things I had to do manually, and as such I went back to Java as soon as I was out of the classes that were "C++ only" and have not touched C++ since.

Had I learned C++ first, I wouldn't have been "spoiled" by Java :)
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
Anymore I am convinced that it really doesn't matter what languages you learn, nor what order you learn them in; the person is what matters. Learn what you want to learn, when you want to learn it, and if you can't learn new things, maybe programming isn't the right field for you. The only thing that I've wanted to learn but have had problems learning is assembly, but that is due to the fact that nothing I have found thus far online does a good job of teaching it, IMO. But eventually I'll learn it one way or another.

btw: I think the pragmatic programmers' suggestion of learning at least one language per year is great advice.
 

Titan

Golden Member
Oct 15, 1999
1,819
0
0
C++ first. Java is a simplification of C++, and if you want to be a well-rounded programmer, i'd start with C++. Mainly because C++ has concepts that help you distinguish and understand how stuff works, like pointers, and memory allocation. It can be a bit more low level which means if you learn it, you could do better as a systems programmer with C, or maybe even give you good understanding of assembler. Java does not have pointers, but it uses them behind the scenes. The one thing every programmer should know after thier first year is how pointers work. Java is too simple, IMNSHO. I learned, you could say mastered C++ before learning Java, and Java took me 2 weeks to learn, because all I had to realize is what I couldn't do that I could do in C++, like use a pointer when I wanted.
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
Originally posted by: tkotitan2
C++ first. Java is a simplification of C++, and if you want to be a well-rounded programmer, i'd start with C++.

I don't know Java, but I am assuming that the difference between it and C++ is a lot more than just some simplifications. Each language has its own libraries and idioms, and those take time to learn.

It can be a bit more low level which means if you learn it, you could do better as a systems programmer with C, or maybe even give you good understanding of assembler. Java does not have pointers, but it uses them behind the scenes.

He could learn Java, and then C++, and then C, and then assembler. Or Java -> C -> assembler. Or Java -> C++ -> assembler. etc. There is no real reason (that I can think of) that it's important to learn C++ first.

The one thing every programmer should know after thier first year is how pointers work.

I'm not sure what this means. I didn't know how a pointer worked after my first year of programming (well, I may have heard "it's like a link or alias or shortcut"), but I didn't have any problems learning pointers (it did take time, and the relationship with arrays was hard to understand for a while, but once I got it, I got it), and I don't have any problems programming in general. And what's a programmer? Someone who does web application coding? Someone who automates system maintenance tasks? Someone who writes database-related apps in VB? Those people don't need to know what a pointer is. And what's a year? Some people code all day, some people only code at work, some people only code as a hobby, some people only code every once in a while. A year of programming is a different thing to each of them.

Java is too simple, IMNSHO.

I learned some VB (way back, in another life almost), and learned PHP, Python, and some shell scripting quite well before learning C++. Those are all "simple" languages. I turned out fine. Just because you learn how to tie your shoes first doesn't mean that you can't be a basketball pro later. And there could be basketball pros who can't tie their shoes, for that matter.

I learned, you could say mastered C++ before learning Java

Ahh here we go. :) It seems that whenever people recommend learning languages in a certain order, it has to do with their own personal experience and almost nothing else. Jzero learned Java first and then had a bad experience with C++, so he recommends not learning Java first. You, on the other hand, learned C++ first, and had a good experience learning Java, so you recommend learning C++ first.

and Java took me 2 weeks to learn, because all I had to realize is what I couldn't do that I could do in C++, like use a pointer when I wanted.

Syntax and whatnot can be learned in 2 weeks, but like I mentioned before, every language has its own libraries and programming idioms, and those take (often considerable) time to learn.
 

Gaunt

Senior member
Aug 29, 2001
450
0
0
I agree with BingBongWongFooey.

Describing one language in terms of another is useless. They are all different, even if they share syntax, or an object-oriented nature.

Some languages ARE easier to learn than others though, but which languages these are is clouded by people's previous experience with other languages. There must be a study somewhere of people attempting to learn different languages without any prior experience, but I don't know of one off hand.

I would suggest figuring out what it is you would like to create as a result of your programming. From there, search a bit and see what languages are commonly used, and pick one that looks interesting and has a reasonable amount of information and support available. It is much easier to start with a specific goal in mind and work towards it than it is to say "I want to program something" and then try and do it.
 

Jzero

Lifer
Oct 10, 1999
18,834
1
0
Originally posted by: BingBongWongFooey
Ahh here we go. :) It seems that whenever people recommend learning languages in a certain order, it has to do with their own personal experience and almost nothing else. Jzero learned Java first and then had a bad experience with C++, so he recommends not learning Java first. You, on the other hand, learned C++ first, and had a good experience learning Java, so you recommend learning C++ first.

But note that both of our experiences point to learning C++ prior to Java. There's something to be said for that. The thing is (and I guess it's hard to see without a background in both Java and C++) that syntactically, Java and C++ are strikingly similar. So similar, in fact, that going from one to the other is almost effortless. The problem is that Java does so much for you behind the scenes, and so much is built right into the API. As a simple example, in Java, a string is a string. Behind the scenes, it's still a char array, but to the developer, you just stay String s = new String(); and you automatically have an array and all of the functions.

Someone going from C++ to Java probably already has a solid feel for how to code a string, maybe even some libraries that they can include to handle it. He's glad he learned C++ first because he has the more intimate knowledge.

Someone going from Java to C++ is confounded as to why something as fundamental as a string has to be constructed manually. If I want to make a copy of string s, why can't I just instantiate string y and set y = s ? Why do I have to use strcopy? Java essentially makes you lazy, and it makes you resistive to going to the more low-level C++ because it seems like you have to do a lot of extra work.

In my experience, Java and C++ are the only languages that did this to me, and I think that is because in many ways, Java is the bastard child of C++. The other languages I've used - Perl, VB, PHP, LiSP, DOS Batch, KixTart...didn't give me this issue. My only theory as to why is that they are so different from C++/Java in both syntax and operation, that I had no preconceived notion about what should already be built-in to the language's API.
 

WobbleWobble

Diamond Member
Jun 29, 2001
4,867
1
0
I learned basic C++ then Java then C then more advanced C++. Java does force the OOP concept and I like that. For that reason alone it gets my thumbs up for the first language. But going from C++ and Java to C was painful.

Just don't learn Ada... waste of time :p
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
Originally posted by: Jzero

But note that both of our experiences point to learning C++ prior to Java. There's something to be said for that.

Yes, but ClueLis suggested learning Java first, and I suspect that if this thread had 100 recommendations, many others would recommend learning Java first, simply because it worked well for them. And there's nothing wrong with making recommendations based on your own past experience - but you should be open to the possibility that other ways work just as well or better.

The thing is (and I guess it's hard to see without a background in both Java and C++) that syntactically, Java and C++ are strikingly similar.

That is true, and I suppose comparing C++ to Java is somewhat of a special case, since their syntaxes are so close.

So similar, in fact, that going from one to the other is almost effortless.

Eh, I haven't ever done so, but I have a hard time believing that it's very close to effortless.

The problem is that Java does so much for you behind the scenes, and so much is built right into the API. As a simple example, in Java, a string is a string. Behind the scenes, it's still a char array, but to the developer, you just stay String s = new String(); and you automatically have an array and all of the functions.

And in C++, you just say string s; and you have the C++ equivalent.

Someone going from C++ to Java probably already has a solid feel for how to code a string, maybe even some libraries that they can include to handle it. He's glad he learned C++ first because he has the more intimate knowledge.

Someone going from Java to C++ is confounded as to why something as fundamental as a string has to be constructed manually. If I want to make a copy of string s, why can't I just instantiate string y and set y = s ? Why do I have to use strcopy? Java essentially makes you lazy, and it makes you resistive to going to the more low-level C++ because it seems like you have to do a lot of extra work.

You must not have learned much C++ (no offense), because it does have strings. strcopy is in the cstring header -- standard library headers starting with "c" are legacy C headers, and <cstring> is one that you almost definitely don't want/need to use in C++ unless you absolutely need to.

// this is c++
string s = "hello";
string y;
y = s; // y is now "hello"

http://cppreference.com/cppstring_details.html

In my experience, Java and C++ are the only languages that did this to me, and I think that is because in many ways, Java is the bastard child of C++. The other languages I've used - Perl, VB, PHP, LiSP, DOS Batch, KixTart...didn't give me this issue. My only theory as to why is that they are so different from C++/Java in both syntax and operation, that I had no preconceived notion about what should already be built-in to the language's API.

Well, I believe that Java was largely meant to be a better C++, so to speak. So I imagine that they just started from C++'s syntax and started changing it to fit their idea of "better."
 

Jzero

Lifer
Oct 10, 1999
18,834
1
0
Originally posted by: BingBongWongFooey
You must not have learned much C++ (no offense), because it does have strings. strcopy is in the cstring header -- standard library headers starting with "c" are legacy C headers, and <cstring> is one that you almost definitely don't want/need to use in C++ unless you absolutely need to.
Yah, as I said, I only used it for the one or two classes I took that required it and then promptly dropped it.
Maybe it was the teacher, or the "brand" of compiler we were using, but the intuitive way of handling strings I was familiar with from Java was nonexistent. That was just an example. There are other things I found missing as well.

But we agree on all points.

I also like Gaunt's point that instead of just saying "I want to learn a programming language," you should come up with a project and choose a language that is well-suited to that project.

 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
Originally posted by: Jzero

Yah, as I said, I only used it for the one or two classes I took that required it and then promptly dropped it.
Maybe it was the teacher, or the "brand" of compiler we were using, but the intuitive way of handling strings I was familiar with from Java was nonexistent.

Sounds like you were learning some bastardized mixture of C and C++. IMO schools should either teach C or C++, not some arbitrary mixture of the two. It just creates a bunch of people who are angry about some hybrid language that doesn't really have a name. C definitely has its uses, but for most uses, I prefer C++ by far. I hate char arrays just as much as you. That's why I don't use them in C++ (except, of course, passing around char*'s to certain things, which is not problematic). Personally I can't wait for C++0x, which is the next revision of the C++ standard. A lot of really great stuff should be added to the language, which either doesn't exist at all yet, or are only in external libraries. It still won't be Java, but well, Java doesn't appeal to me much anyways. :p

That was just an example. There are other things I found missing as well.

Based on you not knowing about std::string, you might not know about a lot of other useful things. And not only are there useful things in the standard library, but you can use whatever other libraries you want, such as boost (boost is *really*, *really*, great).
 

WobbleWobble

Diamond Member
Jun 29, 2001
4,867
1
0
I just remembered that when I learned more advanced C+ I had compiler issues with because one compiler had wanky support for one library and the other had wanky support for another and such. I had several issues with MS VC++6. Borland was nicer to me. These issues may be difficult to tackle when you're learning C++. With Java I didn't have issues between IDEs because I guess they all use javac from Sun?

That's my experience...