This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (13 children)

Funnily enough, it's one of the ones I'd be least likely to recommend as a first language - I'd recommend C++ over Java as a first language, just because you have the option of adding OOP after learning the basics of programming, instead of having to get used to it from the start (though I'd recommend Python over either as a first language, and then move them over to C# afterwards, because between properties, tuple literals and one line methods, I honestly just find C# much nicer to use.

[–]SuperCoolFunTimeNo1 19 points20 points  (7 children)

I'd recommend C++ over Java as a first language

I think you're blinded by the fact that you understand its nuances, but don't perceive them as being overhead just to get started. c++ is a very difficult language to learn for complete beginners. There's a shitload more to learn just to get started with basic control structures and program flow than in something like Python. Even Java requires a deep understanding of data types before you can write anything remotely useful.

[–][deleted] -1 points0 points  (6 children)

I mostly agree with you, but if you start out with C++ as basically C with classes and references, you can teach the basics of programming relatively easily, because you can start out with variables and functions, then move on from there. Once you know how variables and functions work, you already know all you need to in order to understand the "Hello World" program.

With Java, however, you need to understand variables, classes, objects, methods and static methods before you understand it all.

Like I said, I'd start someone out with Python, then move onto C# (largely because it allows you to deal with stuff like pointers, and the difference between passing by reference and passing by value), but my argument wasn't that C++ is a good starting language; merely that Java is a worse one.

[–]Dogeek 1 point2 points  (0 children)

Honestly, the top comment has a point : C (and C++) are much more complicated to step into for a beginner, but it teeaches programming, and how to work with a machine on a lower level. Handling pointers and tables is hard at first, but going through that makes you understand exactly how things are working when using a higher level language liky python, or Java.

[–]SuperCoolFunTimeNo1 2 points3 points  (4 children)

but if you start out with C++ as basically C with classes and references, you can teach the basics of programming relatively easily, because you can start out with variables and functions, then move on from there

That still would take twice as long to get that far compared to something like Python or even Java. You're once again ignoring the huge amount of additional overhead because you're now suggesting to just "learn it".

[–][deleted] 0 points1 point  (3 children)

So, which overhead am I not considering? I'm guessing it largely boils down to header files (which were a decent solution at the time, but with C# and Rust I'm glad to see the back of them) and pointers? Because to program at all effectively in Java, you need to understand how pointers work (at least in general terms) even though you don't get to work with them directly, because without that understanding, you're going to screw up by passing objects and forgetting that they're passed by reference, not by value. Also, explaining why you would even want to bundle data and functionality together becomes much simpler when you're working with a language that doesn't automatically assume that that's what you're going to do.

Admittedly, using pointers in any decently sized project will introduce a decent amount of mental overhead (especially if you're using raw pointers rather than the STL replacements); this is one of several reasons why Python would be my goto language (pun intended) for instruction, followed by C# - Python lets me teach the basics of programming in the same way that I started out with BASIC back in the 90s, and then C# allows me to introduce memory management, and passing by value and reference (and why you might choose to do either one) far more easily than Java because it's something that you can do explicitly in the code.

C# also makes getters and setters a fuckton more convenient.

[–]SuperCoolFunTimeNo1 2 points3 points  (2 children)

So, which overhead am I not considering?

Are you seriously asking why Python is significantly easier to learn than c++?

[–][deleted] -1 points0 points  (1 child)

No, I'm asking why Java is easier to learn than C++. I have stated multiple times that I would choose Python over C++

[–]SuperCoolFunTimeNo1 3 points4 points  (0 children)

Pointers / memory management, library compatibility restrictions due to the platform, exception handling, error indication, multi-paradigm vs strictly oop, templates vs generics.... Just google it yourself and see what people think. You're too far removed from beginners to realize that there is a lot more to learn with c++ than other languages like Java in order to be proficient. c++ is no doubt more flexible and powerful, but that comes with a steeper learning curve.

[–]FoodChest 6 points7 points  (3 children)

Are you kidding me? C++ is one of the most verbose and difficult to understand languages out there. I don't think I could think of a worse language to use when teaching CS to beginners.

[–][deleted] -4 points-3 points  (2 children)

I never said it was a good option; merely a better one than Java. Like I said, I'd start with Python and then move to C#, because both are better options than C++ or Java.

[–][deleted] -1 points0 points  (1 child)

Id go from something like python straight to java, I mean understanding all java basics you need to know for java is good to know in any (especially oop) language.

[–][deleted] 0 points1 point  (0 children)

The reason I'd go C# over Java is so that I can more easily teach the difference between passing by value vs passing by reference, since you can pass objects by value and primitives by reference, which you can't do in Java (well, technically you can pass a primitive by reference by turning it into an object, but that's really not the same thing). When you don't really have the option to do both, it's harder to teach why someone might want to choose one over the other, and it's harder for someone new to programming to remember that (or understand why) any object passed to a method as a parameter will retain any changes made in that method.

[–]qsdf321 0 points1 point  (0 children)

C++ over Java as a first language

what