Archived

This topic is now archived and is closed to further replies.

Maiku

Java or C++ first?

Recommended Posts

Hey you guys, I am new to programming. Infact, the only language I know is HTML... But I would like to learn. Would you guys suggest learning Java, or C/C++ first? And, what are the pro''s and con''s of those two languages? Thanks for your help! -Mike aka Maiku

Share this post


Link to post
Share on other sites
Just an initial disclaimer: neither way is truly ''better''. My personal stance is that you should learn C++ first. I even have the weirder ideas that you should learn C before C++. However, there should be tons of people disagreeing with me that reply shortly, so take everything we suggest as just that, a suggestion.

[Resist Windows XP''s Invasive Production Activation Technology!]

Share this post


Link to post
Share on other sites
If your new to programming, the pro''s and con''s don''t really affect you. Speed, compatibility, and advanced uses just don''t apply to a newbie. The only real thing that I think would affect you is that the Java SDK is quite a meaty download, and along with the relatively slow preformance of Java compilers, it adds un-needed headaches. Also, there are an enormouse amount of C++ resources on the web and in print. And, personally, I found the C++ syntax easier to read than Java, but might just be me.
I''m not saying that C++ is better than Java, just that for a new programmer C++ might be easier to get started with. And, if your not just considering C++ and Java, I recommend Pascal. There is addequate information out there, if you look, and it is MUCH easier to learn and read than both C++ and Java. When you become fairly proficient you can move onto Delphi for Windows programming!
Whatever you choose, good luck on you way to becomming a programing master!

Share this post


Link to post
Share on other sites
Sorry, I cannot recommend C++ for a first language. There are way too many pitfalls and quirks in it, eg char pointers instead of a native string type(yes, I know all about std::string, but is it really that much easier to use for a beginner than a char array?), nasty memory management issues, complex syntax and an unfriendly standard library(yes, STL is a great design in terms of power and flexibility, but compared to container classes in other languages its extremely complex). I really cannot imagine the reasoning behind the earlier posters claim that c++ would be easier to pick up for a beginner.

Learning C++ gets you bogged down in irrelevant language mechanics instead of concentrating on things that are important, such as good style, proper design methods and understanding of algorithms and datastructures. Its also not very motivating to be stuck doing console mode programs for the first couple of months.

Java is the opposite of all that. It has a clean and simple syntax, a much more pure OO approach(its still a hybrid, tho) a very usable standard library(it even has hashtables, something the c++ standards committee never got around to voting on) and garbage collection. It even lets you do basic GUI''s in a matter of days, increasing the motivational factor quite drastically.

I cannot agree on C being a good first language either. My impression is that a lot of programmers who studied C extensively before learning C++, never really progress beyond that C stage. There are lots of things that make a lot of sense to do in C, but that you really shouldnt be doing in C++. See here for Bjarne Stroustrup''s rationale for not learning C before C++.

The bottom line is, learning C++ teaches you C++. Learning Java might even teach you programming too. I believe thats the reason why most colleges have started using Java in their introductory programming classes, because it lets them teach actual programming at a much earlier stage instead of reiterating language technicalities for months at end.
Once you become a proficient programmer, you will find that the language used doesnt really matter that much, and you will be able to pick up new languages quickly. So go with Java(in my mind C# or Python would make great first languages too), learn to program, then you can start focusing on what kind of language would serve best for _your_ purposes.


"I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours." - - Stephen Roberts

Share this post


Link to post
Share on other sites
I would suggest you learn Java first. Java is much simpler and less complicated than C/C++. You dont have to become a master at it to learn C++. Just be thorough enuf with the concepts, syntax and so on. After learning Java, you will find learning C++ much easier. But C++ has additional stuffs like pointers...these may take slightly longer to learn.

Basically, Java is good for web applications and application programs but not for games. Learn C++ for games and Java to develop applications. I am saying this from my experience.

Share this post


Link to post
Share on other sites
quote:
Original post by Arild Fines
I really cannot imagine the reasoning behind the earlier posters claim that c++ would be easier to pick up for a beginner.


I never said it was easier, it was just a personal opinion that I stated. Don''t misinterpret what I was trying to say .

[Resist Windows XP''s Invasive Production Activation Technology!]

Share this post


Link to post
Share on other sites
I wasnt referring to your post, Null:
quote:
Original post by NeOeN

I''m not saying that C++ is better than Java, just that for a new programmer C++ might be easier to get started with. ¨







"I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours." - - Stephen Roberts

Share this post


Link to post
Share on other sites
Personally, I believe that you should learn C++. You DON''T need to learn C before you learn C++. In fact, if you know C++ you can easily understand C code, however, it''s doesn''t work the other way around (as easily). If you know C++, you can also understand Java.

Jason Arora
jason@pubism.com
http://www.pubism.com

Share this post


Link to post
Share on other sites
Bah, typo...should have been "poster"

"I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours." - - Stephen Roberts

Share this post


Link to post
Share on other sites
Sense you mentioned that your only language was HTML, you may be looking for web based programs or little applets. If this is your intent, I recommend java over c++. If your interseted in the concept of programming not just web apps, I think c++ is better to start with. Java makes life really easy by handling all the memory for you, but c++ is more powerful and considered the be the language to program on (note to others:i know c is just as good, but i like c++, and asm is way to annoying to begin with) The biggest hurtile won''t be the language you choose, the biggest hurtile you''ll face is thinking like a programmer, HTML is not a real language, it simply defines the way something looks, not how the user interacts with it, the browser handles that for you. If you can attend a course, if your still in school (some high schools offer programming classes, not sure how many, but all the ones in my area do) if not see about having a friend teach you. Oh and i do recommend Pascal as a first language (you can get a free dos complier from borland if you look hard enough) or QBasic (as if you can find a compiler for that anymore ) both allow you to get to programming without alot of syntax or annoying rules to follow. Have fun and browse the web and your libary. We all need more programmers in the world, the market is pretty open right now.

Share this post


Link to post
Share on other sites
I suggest you start reading about C and then take a programming design course in college. Then move into C++ then take another course on how develop for object orientated programming design.
Learning language syntax and style is most important in beginning of your programming carreer. Later the focus will move towards design methodologies and thinking in High Level Abtracts.

So
1. Pick a Language
- C probably the best language you could use to learning higher
- level functions, but has better interface to work with the
- hardware. Basically for programming computer graphics and
- sound.
- It also has a good interface to learning API functions for
- computer graphics and sound. API is just a fancy acornym for
- Application Programming Interface, it is a high level concept
- to dealing with low level hardware programming issues.

2. Learn the syntax and style of your language of choice
3. Learn how to design using your programming language of choice
4. Read more stuff about programming
5. Consider going to a programming college
6. Read more stuff about programming
7. Visit internet sites that have programming tutorial about programming.
8. Read more stuff about programming
9. If your still stuck then go back to 4

Edited by - black marq on November 4, 2001 10:21:59 AM

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Learn C or Pascal first. First thing, if you are new to programming, is to learn how to program, and for that purpose, the simpler the language the better. Many people talk about pointers, but learning to be able to track memory allocation is a big step towards creating a nicely structured programs. A program is not just a series of instructions or amalgamation of objects. Program is a representation of your idea on how to sold a particular (type of) problem. It needs to be structured, and requires design. Programming is a process of translating your idea into design and finally into software. Java hides too much from the programmer which I feel is not a good thing for a newby. C++ is too complicated. In order to use either Java or C++ effectively, you will need good understanding of object oriented paradigm. The understanding does not come from reading few books, but experience in writing many applications, and then learing from mistakes you make. Try to write a small program using C, then try to continuously modify it and expand it. See where it breaks and why it breaks. Then think how it can be improved. Most cases, a better design will solve your problem. However, in order to translate the design into software, some assistance from the labguage and compiler may make your life easier. It is then you should look into object oriented paradigm, and C++.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
C++C++C++C++C++C++C
For games anyway.
To say that C is simpler is not completely true.
C++ is more complex but much easier to read, better design etc.


[edit remove all the damn C++.... because it messed up the thread]

Edited by - Magmai Kai Holmlor on November 4, 2001 9:41:31 PM

Share this post


Link to post
Share on other sites
I would choose C++.

I have a fairly good knowledge of both languages, but I think C++ would be better for a beginner, that is where I started.

The only real thing that Java has over C++ is that it can make real neat applets for display on a webpage (i.e. Pacman - favorite one I made). You can do it with C++ and CGI, but it is a tad more complex.

Java is essentially C++, but with a few extraneous things omitted. If you learn C++, Java would be real easy to switch to.

For programming games you can use both because I know there is an OpenGL SDK for both of them. But, more people use C++ than Java. It is essentially the industry standard.

Java isn''t necessarily slower than C++, some people say it is, but for a beginners purpose it isn''t.

If you had to do some major number crunching real time computational fluid dynamics physics simulation of oil traveling through a convergent-divergent nozzle C++ probably would probably have an edge.

The main thing a beginner has to do is LEARN how to program, regardless of the language. Once you learn how to program you can program in any language (things like x86 Assembly take a little more in-depth knowledge and discipline though).

Good luck!

Share this post


Link to post
Share on other sites
quote:
Original post by Viscous-Flow

The only real thing that Java has over C++ is that it can make real neat applets for display on a webpage (i.e. Pacman - favorite one I made).


<brando>The ignorance...the ignorance</brando>
quote:

You can do it with C++ and CGI, but it is a tad more complex.


I''d really like to see that. Pacman done with CGI. Did they make Pacman into a turn based game while I was away or something?



"I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours." - - Stephen Roberts

Share this post


Link to post
Share on other sites
Doing pacman with CGI would be really evil (click, reload, click, reload, heh). You could probably do it with Internet C++ though. I''m not sure how far the project is along yet, but they''ve been working on it for a really long time (long before they showed up on sourceforge).

[Resist Windows XP''s Invasive Production Activation Technology!]

Share this post


Link to post
Share on other sites
People seem to forget that you can teach someone C++ without going into classes and pointers 4 days after starting. Both are "advanced" topics, to be tackled after a good understanding of the language is established. So, basically, a new programmer would end up learning basic C, then tacking on things like templates, classes, pointers, etc. Then, after a few months of programming with classes, the new programmer begins to see how objects fit together, and really start being C++ programmers.

Java, from what I have seen, forces classes on you from the first line you write. Besides which, its a scripting language (anything with a VM is a scripting language in my book =).

As to arguments about programming style, you can teach correct style in any programming language that has comments.

And, about console applications... whats wrong with them? Console apps are fun!

Z.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I cant believe this all these wimps using these wimpy languages.
saying c++ is "complex" or hard to learn. well it is a waste of time to learn. it doesnt give you the control you need for what you are talking about making.

I say assembly is the only way to go for anything. all thatother stuff might help you get a few things done faster, but if it is like most programs, the running speed is what counts. not the development speed.

The point is for true "newbie quality" software, you have to know exactly what 0''s and 1''s are going in and out of that processor. Else you are just a End User of someone who knows assembly. leave that "low level"(i cant believe its called that) programming to the good men who develop office productivity software. that way office workers wont have any extra macro seconds to think about what there name is going to be two seconds from a second ago.

Actually, i don''t know assembly language. I''m a loser with nothing better to do than write this because i already finished coding my game and i''m waithing for it to load. I used c++ so i dont know whats really going on in my comp or how long it will take.

oh..... its ready!!!!!!!

it says "hello world!"

now im gonna learn to make my own text strings that can be displayed in place of hello world.

thank you for reading this far. Actualy, im a c++ programmer and i think its a great language, but i started with qbasic.

it was easy, but i guess the only motivation it gave me was(definitely not cool graphics) that learned it so quickly and understod everything about it and my classmates where all confused and i felt smart.

nowi really have to pee!! bye.

Share this post


Link to post
Share on other sites
quote:

Learning C++ gets you bogged down in irrelevant language mechanics instead of concentrating on things that are important...



LOL - So you''re talking about programming, and language mechanics are IRRELEVANT??? Crazy...

Personally, I would recommend learning C++ first, but I don''t have any reasons other than the fact that I know C++ and don''t know Java =) I too started out with QBASIC, as that gets u familiar with the basic concepts of programming.

---------------

I finally got it all together...
...and then forgot where I put it.

Share this post


Link to post
Share on other sites
quote:
Original post by Arild Fines
[quote]Original post by Viscous-Flow

The only real thing that Java has over C++ is that it can make real neat applets for display on a webpage (i.e. Pacman - favorite one I made).


The ignorance...the ignorance
quote:

You can do it with C++ and CGI, but it is a tad more complex.


I''d really like to see that. Pacman done with CGI. Did they make Pacman into a turn based game while I was away or something?


Can you tell me some things that Java does have over C++ besides web-based integration?

They both are equally portable (if you do it right), they both have similar syntax, for general purposes they run at about the same speed.

Applets are one thing that Java makes simpler (since it is supported by most major web browsers, and has security features that make it useful for the web).

In other words, they both get the job done.

The one about CGI you took 2 literally . I realize that really there is no practical way to do it in CGI, but it is possible even though no one would want to play it .

For the CGI Pacman I guess you could take turns being the pacman and the ghost and decide whether or not to go left, right, up, or down. Not very interesting though.

Anyways, have a nice day!

Share this post


Link to post
Share on other sites
quote:
Original post by AdmiralBinary

LOL - So you''re talking about programming, and language mechanics are IRRELEVANT??? Crazy...


Language mechanics _are_ irrelevant. When(if?) you get to the point where you know more than a couple languages, you will understand that too. C++ has so many syntactical quirks that are totally unimportant when you are teaching programming basics. Programming isnt about languages, its about concepts and paradigms. Pushing C++ onto a newbie clouds this issue.

quote:
Original post by Viscous-Flow
Can you tell me some things that Java does have over C++ besides web-based integration?


Lets see:

  • Simpler syntax
  • Simpler syntax
  • Simpler syntax
  • Garbage collection(you have no idea how many design problems that just vanish when you dont have to mess with memory allocation)
  • Built in threading support
  • GUI support in the base libraries(However, I''ll be the first to admit I wouldnt use Swing for a desktop app)
  • Exactly _one_ way of passing an object into a method. No messing around with defining a copy ctor and operator= just to get your basic Foo class working
  • A _much_ simpler standard library.
  • A cleaner exception model
  • A much cleaner OO approach. Unlike a lot of the posters here, I dont believe that OO is something you should postpone until you know procedural programming well. People all too often get stuck in the procedural mindset.

    quote:

    They both are equally portable (if you do it right),


    Not by a long shot. C++ is at best source-level portable, and even then only painfully so. Java is portable at the object code level - you dont have to recompile for a new platform.

    quote:

    Applets are one thing that Java makes simpler (since it is supported by most major web browsers, and has security features that make it useful for the web).


    I believe applets are mostly considered a joke in the java community these days. The focus is mostly on large scale server development, where development time has been cut drastically due to the advantages listed above.



    "I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours." - - Stephen Roberts

Share this post


Link to post
Share on other sites
I''d say neither of those languages is best for someone just beginning to learn programming (HTML is _not_ programming, more like low level word processing).

First off, while C++ is a great language I don''t think it''s great for someone who is just beginning. The speed advantage C++ proponents wave in the face of Java-ites is pretty irrelevant to someone who barely understands what a variable is. My biggest gripes with C++ (in comparison with Java) is that the code tends to be a lot messier, and the standard libraries aren''t anywhere near Java''s.

On the other hand while Java does tend to have much cleaner code and has fewer language/syntactical quirks because of the total OO approach, forcing OO from the start just doesn''t work. Most courses I''ve seen teaching Java start something like this. ''Here''s your first program:''

public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}

''Now please ignore everything except the "Hello World!", we''ll get to all that other stuff later.'' How do you really explain to a total newbie what''s happening in the above code? They have no knowledge of objects/classes, access modifiers, methods, parameters, etc. The usual solution seems to be to teach bits and pieces that sort of kind of fit together but not really and maybe over time it will all fall into place in the student''s mind. That''s a terrible way to teach.

Another thing I''ve noticed about people learning Java first (mostly college students) is that they tend to have a poorer understanding of what''s going on behind the scenes, at the lower level of bits and bytes (well, that and they think Java and OO are the pinnacle of programming). I tried to explain to a friend how to read text from a file into a Java String and it was probably as much of a headache to me as it was to him. Null terminated strings? Everything is bytes? Ascii? Unicode? This was all pretty new to him.

So I''d say learn Basic or Pascal, something simple. Because the language is simple you don''t have to immediately learn about pointers, OO, or other high/low level stuff. You can get into learning the fundamental concepts of programming instead of getting bogged down just learning a language. Once you''re comfortable with the concepts you can learn more complex things, maybe move on to a different language.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.