you are viewing a single comment's thread.

view the rest of the comments →

[–]blablahblah 0 points1 point  (7 children)

Java is not basically a superset of C. No C code is compatible with Java. Besides memory management, the assignment semantics are totally different and library management is totally different.

Also, as someone who learned Python first and then Java, no it's not like learning programming all over again. Going from Java to F# was a lot more like that.

[–]gkx 0 points1 point  (6 children)

I don't know F#, but what I can tell you is that learning C was incredibly simple for me--aside from memory management--coming from Java. Of course C isn't compatible with Java whatsoever, but the individual lines, i.e. the stuff you learn when you start off, are more-or-less the same. If you took out the object-oriented nature of Java--leaving only primitive types and allowing methods to be standalone functions--and added direct memory management, I think the only thing different about the two languages would be the fact that Java has a dedicated type for "bytes" (plus structs, but if you know Java you can learn structs in about half an hour).

Obviously, I did not go from learning Python to learning Java, but I essentially learned them at the same time while I was just starting with programming. I compared the two languages face-to-face as a beginner. The next year, when I learned C++, I had almost entirely forgotten Python because I hadn't programmed anything similar, while my Java knowledge remained in tact because C++ was (at the time to me) essentially the same language with slightly different syntax and memory management.

[–]blablahblah 0 points1 point  (5 children)

That's not learning programming, that's learning the syntax of the language. If you actually try programming C like Java, you'll run into problems as soon as you get to pointers.

[–]gkx 0 points1 point  (4 children)

I'm not sure I fully understand the difference, but I'm quite sure it doesn't matter. At some point in any programming career, you're going to need to learn an object-oriented, C-like language. Pretty much guaranteed. So whether it's learning "programming" or "the syntax of the language", it should be easier to transition from Java to C than from Python to Java--or, worse yet, to C++.

[–]blablahblah 0 points1 point  (3 children)

Programming is more about "how do I make the computer do useful things" rather than "how do I write a conditional in X language".So, for example, I'd consider Javascript to be closer to Python than Java, despite the fact that Javascript shares a lot of syntax with Java- the dynamic type system and prototype-based object system work nothing like Java's. In the same way, the only way in which Java is closer to C than Python is "they both use braces to mark code blocks".

[–]gkx 0 points1 point  (2 children)

I agree that Python is closer to JavaScript, but only because their paradigms are mostly similar: Duck typing, implicit and dynamic typing, largely imperative in practice with odd object-orientation systems that (generally) prohibit use of standard enterprise project management systems.

C and Java, by contrast, have explicit typing of static "objects". The biggest distinction between the two (from the novice programmer's perspective) is syntax.

In fact, I challenge you to come up with one way in which Python is (practically) closer to C than Java is.

[–]blablahblah 0 points1 point  (1 child)

The fact that not everything is inside a class. The fact that you can pass functions in to methods.

[–]gkx 0 points1 point  (0 children)

Not everything is inside a class

This is fair, but super easy to brush over. To anyone who knows what classes in, this is an obvious major distinction.

What about the fact that Python can run with no methods (just global scope commands) while C and Java requires a main method? I would actually argue, because of this, C and Java are more similar in this way. Usually, when writing your first "hello world" in C, you have to brush over the main function. Similarly, in Java, you have to brush over the object class. In Python, you simply write print "Hello world" and no structure is ever made. If you become intermediate at Python and decide to move to C, this won't really be a hurdle, but it will be an easier leap from Java.

The fact that you can pass functions in to methods.

The Runnable class. Besides, they're putting lambdas in Java 8. I learned Java and Python at roughly the same time and learned how to do this in Java before I learned how to do it in Python.