Need advice about which tool to choose?Ask the StackShare community!
Java vs Python: What are the differences?
Developers describe Java as "A concurrent, class-based, object-oriented, language specifically designed to have as few implementation dependencies as possible". Java is a programming language and computing platform first released by Sun Microsystems in 1995. There are lots of applications and websites that will not work unless you have Java installed, and more are created every day. Java is fast, secure, and reliable. From laptops to datacenters, game consoles to scientific supercomputers, cell phones to the Internet, Java is everywhere!. On the other hand, Python is detailed as "A clear and powerful object-oriented programming language, comparable to Perl, Ruby, Scheme, or Java". Python is a general purpose programming language created by Guido Van Rossum. Python is most praised for its elegant syntax and readable code, if you are just beginning your programming career python suits you best.
Java and Python can be categorized as "Languages" tools.
"Great libraries", "Widely used" and "Excellent tooling" are the key factors why developers consider Java; whereas "Great libraries", "Readable code" and "Beautiful code" are the primary reasons why Python is favored.
Python is an open source tool with 25.3K GitHub stars and 10.5K GitHub forks. Here's a link to Python's open source repository on GitHub.
According to the StackShare community, Python has a broader approval, being mentioned in 2826 company stacks & 3632 developers stacks; compared to Java, which is listed in 2399 company stacks and 2723 developer stacks.
Python has become the most popular language for machine learning right now since almost all machine learning tools provide service for this language, and it is really to use since it has many build-in objects like Hashtable. In C, you need to implement everything by yourself.
C++ is one of the most popular programming languages in graphics. It has many fancy libraries like eigen to help us process matrix. I have many previous projects about graphics based on C++ and this time, we also need to deal with graphics since we need to analyze movements of the human body. C++ has much more advantages than Java. C++ uses only compiler, whereas Java uses compiler and interpreter in both. C++ supports both operator overloading and method overloading whereas Java only supports method overloading. C++ supports manual object management with the help of new and delete keywords whereas Java has built-in automatic garbage collection.
Go is a way faster than both Python and PHP, which is pretty understandable, but we were amazed at how good we adapted to use it. Go was a blessing for a team , since strict typing is making it very easy to develop and control everything inside team, so the quality was really good. We made huge leap forward in dev speed because of it.
I am working in the domain of big data and machine learning. I am helping companies with bringing their machine learning models to the production. In many projects there is a tendency to port Python, PySpark code to Scala and Scala Spark.
This yields to longer time to market and a lot of mistakes due to necessity to understand and re-write the code. Also many libraries/apis that data scientists/machine learning practitioners use are not available in jvm ecosystem.
Simply, refactoring (if necessary) and organising the code of the data scientists by following best practices of software development is less error prone and faster comparing to re-write in Scala.
Pipeline orchestration tools such as Luigi/Airflow is python native and fits well to this picture.
I have heard some arguments against Python such as, it is slow, or it is hard to maintain due to its dynamically typed language. However cost/benefit of time consumed porting python code to java/scala alone would be enough as a counter-argument. ML pipelines rarerly contains a lot of code (if that is not the case, such as complex domain and significant amount of code, then scala would be a better fit).
In terms of performance, I did not see any issues with Python. It is not the fastest runtime around but ML applications are rarely time-critical (majority of them is batch based).
I still prefer Scala for developing APIs and for applications where the domain contains complex logic.
Pros of Java
- Great libraries572
- Widely used433
- Excellent tooling396
- Huge amount of documentation available378
- Large pool of developers available328
- Open source197
- Excellent performance192
- Great development150
- Used for android143
- Vast array of 3rd party libraries142
- Compiled Language54
- Used for Web46
- Managed memory42
- Native threads42
- High Performance40
- Statically typed35
- Easy to read31
- Great Community29
- Reliable platform25
- JVM compatibility23
- Sturdy garbage collection22
- Cross Platform Enterprise Integration19
- Universal platform18
- Great Support16
- Good amount of APIs16
- Lots of boilerplate11
- Great ecosystem10
- Backward compatible10
- Everywhere9
- Excellent SDK - JDK7
- Mature language thus stable systems6
- Better than Ruby5
- Portability5
- Cross-platform5
- Static typing5
- Clojure5
- It's Java5
- Old tech4
- Vast Collections Library4
- Most developers favorite3
- Stable platform, which many new languages depend on3
- Long term language3
- Great Structure3
- Best martial for design3
- Used for Android development3
- Testable2
- Javadoc1
Pros of Python
- Great libraries1.1K
- Readable code922
- Beautiful code814
- Rapid development763
- Large community668
- Open source414
- Elegant375
- Great community264
- Object oriented257
- Dynamic typing206
- Great standard library68
- Very fast51
- Functional programming47
- Scientific computing33
- Easy to learn31
- Great documentation29
- Matlab alternative25
- Productivity22
- Easy to read21
- Simple is better than complex19
- It's the way I think17
- Imperative17
- Very programmer and non-programmer friendly15
- Free14
- Powerful14
- Powerfull language13
- Fast and simple13
- Scripting12
- Machine learning support9
- Explicit is better than implicit9
- Unlimited power8
- Ease of development8
- Import antigravity7
- Clear and easy and powerfull7
- Print "life is short, use python"6
- It's lean and fun to code6
- Python has great libraries for data processing5
- High Documented language5
- Great for tooling5
- Flat is better than nested5
- Although practicality beats purity5
- I love snakes5
- Fast coding and good for competitions5
- There should be one-- and preferably only one --obvious5
- Readability counts4
- Socially engaged community3
- Great for analytics3
- Plotting3
- Lists, tuples, dictionaries3
- Rapid Prototyping3
- Complex is better than complicated3
- Multiple Inheritence3
- Beautiful is better than ugly3
- CG industry needs3
- List comprehensions2
- Special cases aren't special enough to break the rules2
- Now is better than never2
- If the implementation is hard to explain, it's a bad id2
- If the implementation is easy to explain, it may be a g2
- No cruft2
- Generators2
- Simple and easy to learn2
- Import this2
- Easy to learn and use2
- Easy to setup and run smooth1
- Should START with this but not STICK with This1
- Web scraping1
- Because of Netflix1
- A-to-Z1
- Only one way to do it1
- It is Very easy , simple and will you be love programmi1
- Many types of collections1
- Flexible and easy1
- Better outcome1
- Batteries included1
- Powerful language for AI1
- Pip install everything1
- Powerful0
- Pro0
Sign up to add or upvote prosMake informed product decisions
Cons of Java
- Verbosity29
- NullpointerException23
- Overcomplexity is praised in community culture15
- Nightmare to Write13
- Boiler plate code10
- Classpath hell prior to Java 98
- No REPL6
- No property4
- Code are too long2
- There is not optional parameter2
- Floating-point errors2
- Terrbible compared to Python/Batch Perormence1
- Java's too statically, stronglly, and strictly typed1
- Non-intuitive generic implementation1
- Returning Wildcard Types1
Cons of Python
- Still divided between python 2 and python 349
- Poor syntax for anonymous functions26
- Performance impact26
- GIL18
- Package management is a mess18
- Too imperative-oriented13
- Hard to understand12
- Dynamic typing10
- Very slow8
- Not everything is expression8
- Indentations matter a lot7
- Explicit self parameter in methods7
- Poor DSL capabilities6
- No anonymous functions6
- Requires C functions for dynamic modules6
- Hard to obfuscate5
- The "lisp style" whitespaces5
- The benevolent-dictator-for-life quit4
- Lack of Syntax Sugar leads to "the pyramid of doom"4
- Threading4
- Fake object-oriented programming4
- Incredibly slow4
- Not suitable for autocomplete3
- Official documentation is unclear.3
- Circular import2
- Training wheels (forced indentation)1
- Meta classes1