The article is submitted by one of our readers, Michael Kelley.
In the world of mobile app development, developers who are focused on creating apps for Android are faced with a myriad of choices. Although C++ is an object-oriented programming language and has been used to create applications for the Mac and PC, including Microsoft Windows and the Apple operating systems, most developers choose Java because C++ is very complex and unforgiving as a language.
A lot of developers also like the benefits and freedom that Python offers, especially since its roots are in Java. Which language is better for writing an Android app? Let’s take a look at the pros and cons of Java and Python.
One of the main reasons Android app developers favor Java over other languages is that it has been around for a long time. Developed long after C and C++, Java appeared on the programming language scene in 1995 via Sun Microsystems. The most prevalent use of Java was within internet browsers to run embedded programs.
Developers also like Java because it incorporates the powerful elements of C and C++ without the inherent issues of those two languages, such as the fact that it offers no error messages and it’s too easy write in bugs. The other major reasons they prefer Java are as follows:
- Easy to understand and learn.
- It can be used with virtual machines.
- Like C and C++, it is object-oriented.
- Widely supported by a large user community.
- Last but not least, the number of available libraries.
Java Libraries and SDK
Like most programming languages, Java requires a significant time commitment to learn and master it. But depending on the type of app a developer is trying to write, plenty of tools are available. For instance, the libraries in the Android SDK (software development kit) give developers access to data structure, network, graphic libraries, etc., so when they need to learn how to create an android app, everything they require is already there.
Furthermore, in order to encourage Android app creation, Google makes its integrated development environment (IDE) free to developers, which now includes the Android SDK. It’s called Android Studio (freely available for Windows, Mac and Linux) and includes a visual layout editor, APK Analyzer, Fast Emulator (a tool for quickly seeing how apps look and run on a virtual version of a device), intelligent code editor, flexible build system and real-time profilers.
Java in 2018
While other programming languages, such as Kotlin, have become noteworthy among the developer community, Java is still highly regarded. In fact, Java, specifically the Java Virtual Machine, is still used to create large-scale applications. And 90 percent of Fortune 500 companies still rely on it. Although Java developers continue to update and improve it, the platform comes with numerous problems.
One of those problems, supposedly, is that 88 percent of Java apps have security issues. Another problem is that Java uses static typing, which means a developer has to define specific variables that can’t be modified. In the end, if there is a problem in the code, chances are it will have to be scrapped and rewritten.
If a developer wants to write Android apps, then learning and becoming proficient in Java is probably necessary. Having a good grasp of Java would help you use other languages like Python to enhance code, edit variables via dynamic typing, and make it run more efficiently.
In fact, many developers see Python as having a major advantage over Java because it offers quick turnaround times and the reuse of Python libraries. For those you don’t know, an app could be completely written in Python (with no Java code). In fact, it often results in better performance and compatibility.
Some developers have also made the claim that Python makes them 5 to 10 times more productive than with Java. Of course, a developer’s productivity in coding can only be measured by his experience, the type of apps/ software he is writing, and what he requires to do his work.
Python in 2018
While Java maintains its importance in the world of Android app developers, Python is steadily gaining ground as a substantial development environment. Like Java, Python has significant community support, and it also has language flexibility, library support, plus it is much easier to learn as compared to Java. Python has also gained ground in its usage for development of apps and software in artificial intelligence (AI) and data science as well as other areas across web, desktop and servers.
But just like Java, Python has a few issues of its own. First and foremost, while Python is a slick and quick way to develop apps and software, learning and becoming proficient could take time if a developer doesn’t have knowledge of Java. There are some developers who believe that knowing Java isn’t absolutely necessary because of Python’s “literate programming” mode, which contains material that caters to non-programmers.
Also, Python can run only on a single CPU at a time. Additionally, with each new version of Python, the code may run faster, but only with the current version libraries, i.e. if you are developing in Python 3 and linking to Python 2 libraries, performance issues could arise.
Choosing between Java and Python boils down to the details of the app and your own experience. In general, it’s wise for a developer to be well-versed in both languages, not to mention the other languages that may come to the fore as the app development culture continues to evolve.