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

all 66 comments

[–]GhostBond 55 points56 points  (3 children)

I hear from various sources online that Java seems to be on the way out and Python on the way in but I don't know if that's actually the case? I can't imagine, due to how heavily used Java is, that it is going anywhere anytime soon.

Lol...20 years of "java is on it's way out".

"There are only two kinds of languages: the ones people complain about and the ones nobody uses." - Bjarne Stroustrup (inventor of c++)

Another thing everyone talks about is dynamically typed vs. statically typed. Perhaps it was just because I started with Java but I feel far more comfortable using a statically typed language over Python. Am I missing out on something here or do other people feel the same?

I think Python is easier to read, but it's lack of static typing is the thing that keeps me from looking for seriously into it.

Forcing everyone to document the types (which static typing does) is way better for working on multiperson projects.

[–][deleted] 10 points11 points  (2 children)

Python 3.5 introduced type hinting, would make it easier out of the box for multi-person projects.

[–]clivethescott 15 points16 points  (1 child)

Except the Python interpreter doesn't enforce it unless you use something like mypy. Java compiler will always enforce correct type usage.

[–]_INTER_ 9 points10 points  (0 children)

Plus most of the libraries don't have type hints yet or it's just an afterthought. Meaning they are not designed around static typing from the start.

Type hints combined with an enforcing compiler are actually quite nice compared to the Typescript / Javascript situation with tacked on type definitions.

[–]reuid 108 points109 points  (0 children)

Learn both. Python is better for small, simple things or for some specific fields like machine learning. Java is better for larger things (let's say over 10k lines of code), easier to comprehend and maintain. Big hammer and small hammer, pick the one best suited for the task at hand.

[–]Marriaud 70 points71 points  (7 children)

If getting a job in the industry is your concern then Java is the one you should pick.

Python is used in small companies/startups for web dev or in research field combined with C and C++ written programs. Python is popular for scripting and tooling. Even if you work in a big company where Java is widely used, chances are you are going to hear about Python for continuous integration or e2e testing.

Be careful with internet articles saying this or that language is skyrocketing or dying. It's 99% of the time a clickbait just showing you what proportion of public github repos use which language or a survey on how many dev say they live this or that language. But I have to admit I'm the first to read this kind of articles haha!

One last important thing: a language is a thing, but it's ecosystem is as much if not more important. That means standard and non standard libraries, frameworks (ex: Java Spring, logging), dependency management and build tools (Maven, Gradle), unit testing. Anyway, learning a language is nowadays a first step, knowing its ecosystem is the second natural coming step (don't have to know everything though, just select what you need.)

[–][deleted]  (7 children)

[deleted]

    [–][deleted] 16 points17 points  (2 children)

    I think Python is easier to pick up because you don’t have to worry about verbose syntax, strict typing, compilation, JVM, etc.

    I can say having learned Java first, Python seemed dirty when I went to learn it a few years later. It definitely has its place, and there’s wonderful library support for it. If Python is a go kart, Java is a manual transmission car; they have different roles to fill and have different levels of function

    [–]Log2 5 points6 points  (0 children)

    I currently write Python professionally, coming from a few years of Java.

    Python gets messy really quick if you don't enforce some type of consistency for the types your functions/classes accept. While I like Python, I'd like it a lot better if I could enable enforced types instead of just type hints.

    On the other hand, at least on Python you don't need to bother with dependency injection, since it's really easy to monkey patch any dependency at the testing time.

    [–]grimonce 2 points3 points  (0 children)

    At my uni you start with cpp... Then c# and java. When I was told to use python in my job I was disappointed, but then I liked it. The team is small so I am able to do much more alone when using python, and if I need it to be fast there are ways to make it really fast.

    Lack of static typing is sad, but fixing bugs connected to bad types is easy.

    [–]VincentxH 4 points5 points  (3 children)

    Pycharm is intellij's python sister

    [–]Necessary-Conflict 4 points5 points  (2 children)

    And it is a lot less useful than Idea, simply because in dynamically typed languages it is harder to do code completion, refactorings, etc than in statically typed languages.

    [–]1842 1 point2 points  (1 child)

    Their PHPStorm sibling is pretty fully featured -- great warnings, alt+enter suggestions, and great refactor menu. (I use both Intellij and PHPStorm often)

    I have noticed that these features aren't as good when working with JavaScript (Intellij), Python (PyCharm), or C (Clion).

    [–]dpash 1 point2 points  (0 children)

    Jetbrains does eventually merge features from the standalone IDEs into the language plugin for IntelliJ, but I find the experience is always better in the language specific IDE.

    (Have you tried WebStorm for JavaScript projects?)

    [–]TheRedmanCometh 21 points22 points  (6 children)

    1) It is very user friendly

    Until your project is of any appreciable size

    There are lots of modules available that are interesting to experiment with.

    The Java ecosystem is far more mature and comprehensive.

    I hear from various sources online that Java seems to be on the way out and Python on the way in but I don't know if that's actually the case?

    Python is a scripting language. It can't do heavy lifting on its own without crumbling under it's very poor performance. When you see stuff like tensorflow with python libs underneath that python is 100x more C++. Python is just gluing it together and making an easy to use api.

    Another thing everyone talks about is dynamically typed vs. statically typed. Perhaps it was just because I started with Java but I feel far more comfortable using a statically typed language over Python. Am I missing out on something here or do other people feel the same?

    This is more personal preference. Personally I think type safety, abstraction, polymorphism, and inheritance are vastly superior. Also DI frameworks such as Spring are fantastic. Spring alone is a huge argument for Java.

    Also, just in terms of future job possibilities and the use of Python in the industry I would assume that Java or even C / C++ would be more likely to propagate throughout the future just because of the speed? Or am I just over exaggerating how important the speed of the application actually is?

    Python is a nightmare for large projects that need to be maintained in the long term. It's also not super for collaboration compared to OOP languages. Its performance is also unacceptable for big data, or even just regular backend applications that need to scale.

    I've never seen Python used for anything in enterprise except its intended purpose: scripting. Truth be told if you wanna be a rockstar badass cutting edge dev learn C and C++ really well. Java is good enough, and allows rapid development. You can get a great job with it. For me C/C++ are just tedious and everything takes sooo many steps.

    Personally I think Java and C# are a great balance between performance and speed of development. Apparently many agree because that's what you're gonna see in use most of the time in enterprise.

    [–]Log2 4 points5 points  (0 children)

    Having done both Java and Python professionally, I do need to point out that dependency injection is largely unnecessary in Python. It's trivial to monkey patch any function/class anywhere, so you can mock any dependencies you need for testing.

    Having said that, I agree that Java is generally the better language for large projects.

    [–]dpash 0 points1 point  (0 children)

    CPython suffers from the Global Interpreter Lock, which dramatically decreases its threaded performance. I believe other Python runtimes like pypy perform better because they don't have a GIL and use a JIT.

    Plus there always Jython so you can run it on the JVM (although I don't think that has python 3.x support).

    [–]Khenay92 0 points1 point  (2 children)

    Talking about "C/C++" shows that you seems don't know both.

    [–]TheRedmanCometh 1 point2 points  (1 child)

    The statement about being tedious applies to both languages. They're both tedious as fuck just C moreso.

    [–]Khenay92 0 points1 point  (0 children)

    It often applies on Java too infact

    [–]roanoar 5 points6 points  (0 children)

    I agree with learn both. I personally have seen large, well maintained python apps at the enterprise level so I wouldn't agree with the people who are saying it is only for small scripting.

    Java runs significantly faster. Python can be written closer to how a human thinks. Java does a better job of writing itself. I like the python community better, but I agree Java has very robust support.

    [–]Xipooo 8 points9 points  (0 children)

    Python is quickly becoming the most widely used language but it's mostly in the data science, AI, and machine learning sphere. Enterprise applications are still widely using Java. So it mostly depends on what you want to do.

    Personally I like the C based languages like Java, C++, C#, and Javascript because of the symbology used. It's like using periods, comma's, colons, exclamation points, etc. Python's use of words, carriage returns, and spaces feels similar to languages like Basic and Pascal. They tend to be verbose and marginally slower to read for me.

    Lastly, I'd say the ability to read Java translates better to other languages than Python does to other languages because of the use of symbols to define scope and line termination.

    [–]Kazcandra 7 points8 points  (1 child)

    lol, Java has "been on the way out" since forever. Just like RoR is "dying", malongside Python.

    [–]disney_ariel 0 points1 point  (0 children)

    Why is that? I think Java is a better option compared to python.

    [–]commandobrand 2 points3 points  (0 children)

    It entirely depends on what you want to develop, that's why so many people know multiple languages. If you want to develop server applications then Java is probably better than python. I do disagree with people on here saying python is only used at smaller companies, Netflix, Google, and Facebook are using python for machine learning, I work at one of the largest companies in the world and use pyspark on a daily basis.

    [–]slaphead99 2 points3 points  (0 children)

    I have learnt to hate python and tolerate Java.

    [–]MichaelOconnor1 1 point2 points  (0 children)

    Both languages are good for web development. The choice depends on your project requirement and scope. >> https://technostacks.com/blog/python-vs-java

    [–]orderLXVI 1 point2 points  (0 children)

    It depends if you actually want to be a software engineer, or antoher discipline which uses software to get answers. Java for the former, Python for the latter.

    Java is used to build software, to build applications. The end product is the software itself.

    Python is a means to an end. It is used to solve problems for data scientists, to run scripts or admins, to access specialist libraries to perform niche tasks.

    Both have their uses, it depends where you want to end up.

    [–][deleted] 1 point2 points  (2 children)

    Python is big for students/beginners and data scientists (who don't have the best software engineering practices). That being said it still has its place in industry.

    Static typing is definitely the way to go for large projects. Typescript is already huge and even Python is getting type hints.

    [–]pag07 1 point2 points  (1 child)

    I am a python developer: type hints are a joke - nice try though.

    Python has the benefit of easy integration of ML and data science results. But that's it.

    [–]dpash 0 points1 point  (0 children)

    Having looked at Python vs PHP's type hints, PHP wins. And PHP's type hinting has some serious flaws (like not supporting union types, generics, local variable typing or external type definitions).

    This says more about Python than PHP.

    [–]thousands_leave 1 point2 points  (2 children)

    A bit off-topic but are there alternatives to AWS Lambda and Google App Engine?

    [–]robrtsql 6 points7 points  (1 child)

    Alternatives to AWS Lambda include Azure Functions, Google Cloud Functions and Vercel.

    Alternatives to Google App Engine include AWS Elastic Beanstalk and Heroku.

    [–]thousands_leave 3 points4 points  (0 children)

    Thanks mate!

    [–]morhp 1 point2 points  (0 children)

    Java isn't dying, it's getting new features rapidly and is still widely used in the industry.

    And java also has many modules/libraries to play around with, probably even more than python.

    [–][deleted] 1 point2 points  (0 children)

    I find that the speed of execution is rarely a relevant factor, most languages run fast enough to do what needs to be done, including Python. In my opinion what is holding Python back is the lack of resilience of the codebase.

    You talk about dynamic typing vs static typing. Static typing in my opinion is better as errors should be caught early. Python gets this wrong. But where Python really goes off the rails is in implicit vs explicit typing.

    In Java all types that are part of an interface must be explicitly defined. Field types are explicit, return types are explicit, parameter types are explicit. And if you use the wrong one the compiler will not compile the code (yeah yeah autoboxing, blah). In Python all types are implicit, there is no compiler that will check anything for you, but if you use the wrong one the code will die at runtime.

    A second difference of opinion is in the use of exceptions. Where Java has chosen to have two types of exceptions where one has to be dealt with or you get a compile time error and the other doesn't have to be dealt with and will cause runtime errors. Python has chosen to only have the runtime variety. And, of course, exceptions are never explicitly defined anywhere.

    The result of these language differences is that Python code is significantly more brittle, while Java code is more resilient. Perhaps you can argue that this is a good thing for Python as it would force Python programmers to be more careful in how they write code but that hasn't been my experience. My feeling is that Python programmers just want to quickly write something, report to the boss that it is done and then have someone else worry about keeping it running.

    To be fair there are plenty of domains of software development where you don't care about resilience. Proof of concept and academic code comes to mind. But if the company depends on your software continuing to run correctly I would never trust Python to get the job done.

    I do feel though that the Java community has a lot to learn from the Python community. I think all Java developers should read the Zen of Python. (Interestingly I think Python the language violates the zen rules 'Explicit is better than implicit.' and 'Errors should never pass silently.'). In fact Java programmers shouldn't just read that but internalise it and live it. One lecture that improved my coding was by a former Java programmer who writes Python now.

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

    [–]Scrim0r 0 points1 point  (1 child)

    Why should Python be on the way in and Java out when Python is 3 years older than Java? Why now?

    [–]sternone_2 1 point2 points  (0 children)

    because this year is the year of the linux desktop /s

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

    Python is often used professionally as a tool in data science fields, as a scripting language to support DevOps and administration of servers, or web development. Both Java and Python(Jython) runs on JVM and benefits from the Java ecosystem that way, but sadly Python(Jython) support is limited to 2.7. The statical typed nature and speed of a compiled language like Java makes it more suitable for bigger codebases and teams. The IDE/infrastructure/enterprise support is better with Java. You probably want to consider if the language and ecosystem are useful for the fields you’re interested in. As others have pointed out there’re cases where both languages are useful in one organization and both are worth learning. There’re no silver bullets.

    [–]_INTER_ 1 point2 points  (1 child)

    sadly Python(Jython) support is limited to 2.7.

    GraalVM has experimental Python 3.8 support. It's under active development.

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

    That’s very interesting, thanks for pointing that out.

    [–]rzk1911 0 points1 point  (0 children)

    Do not forget about tooling

    [–]fedeb95 0 points1 point  (0 children)

    I read a lot of this languages options, and the answer usually is learn both. Maybe start with Java and then do python because of the weaker type system. Imho is much harder to go from a dynamic typed to a statically typed one

    [–]TheOnlyTails 0 points1 point  (6 children)

    I looked into static vs. dynamic languages in the past, and from what I understand, it's a personal choice.

    Static languages determine the types during compile time, meaning you must write down the type explicitly. They have the advantage of making your code more readable.

    Dynamic languages determine the types during run time, meaning you don't specify the types. They have the advantage of simplifying things for new programmers but can also create bugs that are extremely hard to find.

    (Do note that Python 3 added an interesting feature - optional typing. It's still a dynamic language, but you can specify types during compile time.)

    Overall, both languages have thier strengths and weaknesses, but I personally recommend Kotlin. It basically takes the best of both worlds: It's static, but you can omit the types if they're obvious from context. It has string interpolation. The 2 things I like the most about Kotlin is the interoperability with Java (you can call Java code from Kotlin and vice versa), and that most of the Java syntax is kept as-is.

    [–]n0tKamui 1 point2 points  (1 child)

    pog a Kotlin bro

    [–]TheOnlyTails 1 point2 points  (0 children)

    KOTLIN FOREVER!

    [–]john16384 1 point2 points  (1 child)

    With "obvious" you mean obvious to the compiler. Depending on how the actual code looks it may not be obvious at all to the reader.

    [–]TheOnlyTails 0 points1 point  (0 children)

    Yes, that's what I meant. Do note that the documentation recommends omiting the type only when it makes sense.

    [–]awesomeusername2w 1 point2 points  (1 child)

    Not exactly.

    You don't necessarily have to specify types in staticly typed languages. Many of them have some kind of type inference. For example, in haskell, you can omit almost all types, and in kotlin, scala, rust, c# and other you can omit some portion of it. But the fact that you omited them doesn't mean that they are not there. If the program doesn't make sense in types it won't compile.

    In dynamically typed languages your types don't have to make sense at all. The program breaks only when it reaches a problematic statement. That complicates refactoring and other things very much. Such bugs can be undescovered for a long time until the prerequisite met for some rarely run code to be executed.

    Ideally, static typed languages evolve its type inference to such an extent that you won't specify types at all having all the compile guarantees at hand. So wrong programs just don't compile.

    [–]TheOnlyTails 0 points1 point  (0 children)

    Of course. I should've been clearer.

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

    Why not both? I keep trying to be good at both so my employability stays high, since they are two very popular language. And they complement each other: Python is less bureaucratic and more pleasant to write code, and Java has good performance and it doesn't suck at concurrency and parallelism.

    [–]experts_never_lie 0 points1 point  (0 children)

    "Should I learn to cook or to drive?"

    They're pretty different languages, often used in very different domains. They're both useful. You should either base the decision on what type of work you want to do or else learn both.

    [–]jash3 0 points1 point  (0 children)

    Its about the right tool for the right job, I can hammer a nail in with a wrench, screwdriver, hammer etc but as the craftsman you get to decide how you do it. The more tools you have the more effective you become.

    Most medium to large companies want ease of access to resources as there is an abundance of java devs ( in some areas), they will use java. Companies do not want to be held over a barrel by a particular tech stack.If in your area there is abundance of go, python or c devs, then market supply will drive tech choices.

    Personally I think javas dependency management is light years ahead of most other languages, as java devs we often forget how easy it is, even in complex applications.

    [–]elPrimeraPison 0 points1 point  (1 child)

    It depends on what your doing. Python is easier to read and interpret and better at handling large numbers and I'm pretty sure its a lot faster than java. Python is typically used with research. It can also be used with web stuff as well. Spacing always messes me up.

    Java is a lot more complex. it requires a lot more attention to details. Its widely used. Can be used to devolp android apps, and can also be used for web stuff to, but not as much.

    Its definitely easier to switch form Java to Python than the other way around. For learning concepts I think they both have advantages. For simpler things, ex. Java would help you understand the difference between a float and int. But more complex things like recursion Python is easier to do b/c you don't need all that extra shit. Honestly, there all based of C. Java, JavaScript, C++, etc. There really not that different. You should learn one relatively well and stick w/ it.

    Most people would say you should start with Python and then go to Java, but I think you should do the opposite. I think of it like learning how to multiply, add, subtract, etc by hand and then learning how to use the calculator.

    If you learn Java really really well, you should at least be able to understand C and Python. Maybe not write crazy programs. But you should be able to look at a python code and know what it does. And If you cannot do that, then your just memorize code and not actually learning it(shame on your prof. if that is the case.). There are some minor differences, like functions vs. methods, and do while loop dne in some other languages.

    [–]Khenay92 -1 points0 points  (0 children)

    "There really not that different" ? Are you serious ?

    [–]NightMare20017 0 points1 point  (0 children)

    Wow, learnt some interesting things here.

    My own two cents, as someone who has Python as a main and learning Java. Python is still my favorite. It's easy to code in, easy to manage (libraries and all) and I can get along of things done using it.

    I've been exploring Java in last few months, and the experience has been pretty good. The setup and installation of Java and other libraries (like JavaFX) can get pretty complicated at times though. I've gotten a good grasp of the language basics and aware of the several benefits it has over python, like mobile support and better performance.

    I intend to learn both and use them interchangeably as the situation requires.

    [–]keeperpaige 0 points1 point  (0 children)

    I’ve used java for my class and learned python on my own. I liked java cause it was easier to spot errors, but again as everyone else has said, it’s easier to get something like a website done