Advertisement

Java or C++ first?

Started by November 03, 2001 07:08 PM
41 comments, last by Maiku 23 years, 1 month ago
o.O
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.
Advertisement
quote: Original post by Arild Fines
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!
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
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
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.
Edsger W. Dijkstra observed in "Selected Writings on Computing: A Personal Perspective" that "It is practically impossible to teach good programming style to students that have had prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration."

"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
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
Advertisement
java-script...
well - you are completely new to programming - you know HTML - use java-script to play around and get a idea of programming - you can make games in java-script.
I also think that Perl is a quite good language to start with, it is quite forgiving when it comes to crappy code.

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~I'm looking for work
quote: Original post by JOL
I also think that Perl is a quite good language to start with, it is quite forgiving when it comes to crappy code.

Too forgiving. But I love it anyways (and can''t wait for Perl6)


I wanna work for Microsoft!
Arild Fines:

In regards to your previous post on those reasons:

  • 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.

    Generally, all those are your own personal thoughts, which I do respect and agree with in part, but I have my own way of writing syntax as do you.

    It is up to the programmer to decide which syntax they think is more simpler, cleaner, and efficient.

    Personally, I think that all programmers (not necessarily an absolute beginner) should learn some sort low-level language such as assembly (it''s probably not necessary to learn machine code; does anyone code at that low of a level nowadays?) It is useful since they will understand what is going on behind the scenes (i.e. registers, stacks, bits) and have a more thorough understanding of code, and realize how some more advanced techniques work.

    You are right that people don''t have to be taught procedural programming before going into the OOP paradigm. It''s just a matter of preference and the person''s aptitude.

    You are right that Java doesn''t need to be recompiled if you move to different systems (unless the virtual machine is different or doesn''t support something). But, they can both be portable, yet it is generally more difficult with C++.

    About the applet one, I do realize that server based Java programs are becoming increasingly popular, but I was directing my post towards a beginner who probably doesn''t understand or have any current application of a server based system. Most avid beginners are interested in making a game of pong that can be easily done with an applet and the included graphical capabilites of Java.

    Have a nice day!
  • First of all, let it be known that I am still a newbie by most people's standards, even though I have been programming a little over a year.

    Also, let it be known that C++ is the first language I have ever learned. I can decipher C if I try hard enough, b/c it's semi-intuitive if you know C++; and I'm also learning a little bit of Java, even though I haven't dedicated myself to that task like I did (and still am) to learn C++.

    So, my suggestion is this: learn C++ first, because then you won't have to make such an effort to learn C. Then learn Java.

    -------------------------------
    "I do not feel obliged to believe that the same God who has endowed us with sense, reason, and intellect has intended us to forgo their use. "
    - Galileo Galilei


    Edited by - Ghostface on November 5, 2001 7:45:42 PM
    ------------------------------"I do not feel obliged to believe that the same God who has endowed us with sense, reason, and intellect has intended us to forgo their use. " - Galileo Galilei

    This topic is closed to new replies.

    Advertisement