DEV Community

Cover image for Python or Java? Which is better to learn to code?

Python or Java? Which is better to learn to code?

javinpaul on February 22, 2020

Disclosure: This post includes affiliate links; I may receive compensation if you purchase products or services from the different links provided i...
Collapse
 
drm317 profile image
Daniel Marlow • Edited

There are three programming styles: structured, object-oriented and functional.

I’d say pick a language for each.

Collapse
 
javinpaul profile image
javinpaul

That's actually the best suggestion for professional programmers. What is your pick for those? Mine is C, Java/Python, and Scala

Collapse
 
olegthelilfix profile image
Oleg Aleksandrov

Thanks for your post, but java 8+ can be more compact
For ex:
String operation:

        String test = "compare Java with Python";
        Arrays.asList(test.split(" ")).forEach(System.out::println);

About maps

        Map<String, String> map = new HashMap<String, String>() {{
            put("1", "2");
            put("2", "3");
        }};

        map.forEach((key, value) -> System.out.println("key=" + key + " value="+ value));

And other examples I think can be made shorter.

Collapse
 
javinpaul profile image
javinpaul

Indeed, Java 8 makes Java code more concise.

Collapse
 
w3hubs profile image
w3hubs.com

I preferred python. :)

Collapse
 
javinpaul profile image
javinpaul

Good choice, congratulations :-)

Collapse
 
w3hubs profile image
w3hubs.com

ya thanx :)

Collapse
 
jouo profile image
Jashua • Edited

Nice post!

Today I began a course on JVM performance and memory management (I've been experiencing memory leaks), it's been a joy so far, I already liked Java and now even more

There are so many JVM settings to enable and / or tweak, it's amazing! (along programs to check the memory, all sorts of stuff)

Is there a thing like that in Python? serious question, I don't know

Collapse
 
javinpaul profile image
javinpaul

That's actually a good skill to master. which course are you using? would you mind to share with us? Regarding performance improvement settings in Python, no I have not heard of, maybe someone knowledgable in DEV can show us light.

Collapse
 
jouo profile image
Jashua

This one, it doesn't have many ratings but the guy is an amazing teacher

udemy.com/course/java-application-...

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

My favorite is Kotlin, as

  • You can extend anything. (But it can be overdone.)
  • You can use any reserved words, but quoting with backticks
  • Not forced to use Class
  • async is easy.
  • generator / yield is easy.

Not sure if you have to learn Java first, though.

JavaScript with modernized syntax can be pseudoly good. (Because it actually stands on older syntaxes.) It is quite elastic to my needs too. That's why I love Node.js.

I have come to dislike Python, because of snake_case and namespace cluttering (e.g. global, reserved words, after for loop).

I believe that Golang should also be learnt, because of different syntaxes / style of coding.

Collapse
 
javinpaul profile image
javinpaul

Yes, Kotlin is good and you can't avoid JavaScript anymore. Python has its shares of problems like managing a big code base is not that easy and whatever you mentioned but the power it gets from its module is just too big to ignore.

Collapse
 
shaijut profile image
Shaiju T

😄, I used to have questions like which language is better ? After discussing with my friends and listening to people online, I realized that Its better to stop asking these questions. Instead start asking which tool is better for current Job and Trend.

Choose the right tool for the Job.

  • Based on your experience, you can use C# or Java for building enterprise and large applications.
  • Instead JSF you can think of using Anuglar orReactorVueetc. for Front End.
  • Python for Machine Learning.
  • Go for Micro Services based performant applications.

In future maybe today's Languages and Framework may be outdated, so to survive you will be forced to learn new language of that time.

Conclusion:

  • Developer Happiness, stick to the language which make your life easier, like easy to read syntax, maintainable, has Good IDE. I like C# for current work, and its up-to you to decide what you like.

  • Its always good to be Open to learn any language as required and Choose the right tool for the Job.

Hope this helps.

Collapse
 
jerome profile image
Marc Jerome

I think transitioning to other programming language wouldn't be an issue if a beginner chooses java as his first programming language. Since it's verbose, transitioning to other verbose language such as C# or any languages with just enough writeability, would not be so difficult.

Also, beginners may want to explore other programming languages so I think java's verbosity can help.

Collapse
 
manishmha profile image
Manish Maha

Thanks for sharing all the information with us all.
Data Science Online Training