The problem with learning a new programming language lies not in learning a few language constructs; it lies in getting to know the libraries and the whole ecosystem around the language.
After a lot of Pascal (had it in high school and first year of uni, wrote some bigger CRUD apps in it, silly I know) and C, it was really hard for me to adopt python. I just couldn't shake the feeling that I had to do everything myself, (even though python provides you with everything you need, I end up writing some function which with a bit of googling already exist as a part of language), that I got from C and Pascal (where I had to write even my own text parser for some apps I did). So I was bashing my head against the wall every time I tried to use python. So in the end I failed and Java was next thing I hit. It was cool. But it was interesting that after learning Java it was much much more easier for me to adopt Python. It was weird in the beginning where you have function for a lot of things, but Java seemed to have rewired something in my head. ¯\_(ツ)_/¯ after using Java my Python was much better. Still not good enough in my opinion, as it is hard for me to wrap my mind around some concepts that are different in Python, where you do not have to type a lot, and things are pretty much done with using packages and functions (external or internal API). It seems like a lot of alchemy and blackboxes to me (python little less, but Javascript is totally like that). And I read a lot of books, even some practical ones, wrote few smaller projects, but it always blew my mind that I write ~100 line program in python, and exact same thing would take me like few hundreds or even thousands in C. But I am mostly interested in systems/OS programming so understand me...
Does anyone know of any resources like this to go the other way - Java to Python? I know a minimal amount of Python but want to learn more. And I know Java very very well. I feel like this learning style is perfect for me and would help me understand Python a lot better.
I just have one question: Why?<p>Why, in this day and age, learn Java unless you absolutely must? (which you probably will, at some point, but if you're lucky, maybe avoid it). It was a pretty miserable language to begin with, and has since been surpassed in just about every way.<p>If you're thinking about using Java for a project, you can probably use C, Rust, or JS/Python/Ruby/etc. Hell, you could even use Haskell, ML, Lisp, or Smalltalk, if you're that sort of person.<p>But don't use Java if you can avoid it. It will make you feel better, likely improve your productivity, and make you stop wishing that you could commit seppuku.
I wish there was a Java for JavaScript programmers. I was looking for one the other day, couldn't find it. There are plenty of JavaScript for Java devs!
public class Hello {<p><pre><code> public static void main(String[] args) {
StringBuffer output = new StringBuffer();
Process p;
try {
p = Runtime.getRuntime().exec("pwd");
p.waitFor();
java.io.BufferedReader reader =
new java.io.BufferedReader(new java.io.InputStreamReader(p.getInputStream()));
String line = "";
while ((line = reader.readLine())!= null) {
output.append(line + "\n");
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println(output.toString());
}
</code></pre>
}<p>/home/jobe/runs/jobe_AnIK6J<p>probably not a good sign....<p>Do python repls let you execute anything on the host?
I only used Java when I was in school, has the standard changed to always use the boxed type?<p><pre><code> for (Integer i = 0; i < 10; i++ ) {
System.out.println(i);
}</code></pre>
I guess the real reason for a scripting language programmer to go Java is that you want to use the JVM?<p>Otherwise, wouldn't it be simpler to just profile to find the slow places in your existing code -- then rewrite those in C? You can use the scripting language for most code, where it shines -- speed of development. And still get a good speed of execution.<p>If you need even more speed (you wouldn't really get less memory usage!), then sure... Java is one way to go for a Python/Ruby/Perl/PHP guy. But... when is it the best choice?