30 April 2020

Advantages and Disadvantages of Java


Welcome to the second tutorial. In the previous tutorial, I explained the history of Java briefly, how Java works and what can we use Java for. In this tutorial, I'll be showing you the advantages and disadvantages of Java. The rest of the tutorial for this series can be found in this post, check it out if you’re interested in reading the rest of the series.




Advantages of Java

List of Java advantages:

  1. It's quite easy to learn.
  2. The typing of Java
  3. Object-Oriented-Programming (OOP)
  4. Plenty of powerful standards libraries
  5. platform-independent language
  6. Multithreading programming
  7. Resources availability

It's quite easy to learn Java




Java is quite an easy language to learn as it has an English like syntax. A programming language syntax is the structure and rules we need to follow when using a programming language. Programming languages such as C++ and C have harder syntax than Java. Here's a simple "Hello World" program in Java.





Typing of Java



Java is also a strongly-typed language, meaning that it requires datatype with for every variable declaration that we make. For now, think datatype as the format for the data we want to store. Now, as for variable, imagine it as a thing that could temporarily store data for our program. Some might think specifying datatype is a waste of time, or inefficient. Still, it helps us by making sure we didn't accidentally use the variable for another datatype, which might result in unexpected input used.

Besides being strongly-typed, Java is also a type-safe programming language. Type-safe means the compiler would check for all of the types while compiling, and throw an error(s) if you try to assign the wrong type to a variable. The benefits of this are it gives us some security when writing a program that might grow to a program with several hundred or thousand lines of code.


Object-Oriented Programming (OOP)



Java support Object-Oriented Programming or OOP, which is a very important programming paradigm. In OOP, everything is treated as an object. This concept involves reusing code and make use of modular programs. OOP also associate with concepts like classes, inheritance, polymorphism, encapsulation, abstraction, etc. More explanation will be provided in the upcoming article.


Plenty of standard libraries to be utilized



Java comes with plenty of powerful libraries, and one noticeable library would be the Math Class, which gives us the ability to perform mathematical calculations and manipulation in Java without us stressing out how to implement the formula or methodology. For example, square root, rounding, and even perform trigonometry functions like cos, sin, tan. 

Other than Math class Java provides much more standard libraries such as for I/O, networking, databases, server, and almost everything we needed. Therefore, we can do many things with Java. All these standards libraries could help us save our time by allowing us not to reinvent the wheels when facing problems that have already been solved by peoples throughout the world.


Platform-independent language



Java has a really great feature where it let us write our software once, and the software could be able to run on any platform available. It reduces the work needed when the developers decided to change their platform to another one. The developer only needs to manage one code base, which decreases the program complexity and easier maintenance and scaling. This feature, in turn, reduces the cost required by the developer or company for software development and maintenance process.


Multithreading programming



Java is one of the programming languages that support multithreading. Multithreading is the capability of the program to execute multiple tasks simultaneously. It utilizes available resources while maximizing the computer's performance when executing tasks. This topic is quite advanced, but I'll try to make a tutorial on multithreading using Java.


Resource Availability



Since Java has been around for quite some times now, and there're many training courses available to learn Java on the internet. Most of the resources are free. You don't need to spend a fortune to learn how to program in Java and most of the other programming language. Take my blog as an example, my blog doesn't charge you anything when you visit it.


Disadvantages of Java


List of Disadvantages:

Performance



Since Java is a high-level language, as well as other high-level languages there's some drawback's in performance due to the compilation and abstraction of the virtual machine. Java also consumes a lot of memory compared to other languages like C and C++. Beside that features like garbage collector is a handy feature, but it could become a significant problem to the performance if it somehow takes up a lot of the system CPU.  

Misconfiguration in caching could also lead to excess usage in memory and garbage collection. Although all of these problems could be prevented if the system is planned by skilful developers before starting the development phase.


The Feel and look of Java GUI




The GUI (Graphical User Interface) application written in Java using Swing library while using the default look has a different feel and look from the native ones. The developer will need to design themselves if they want a better-looking application. Swing is an old GUI library, but it's reliable, cross-platform and has already been integrated into several popular IDE (Integrated Development Environment) like NetBeans and Eclipse. Another library called JavaFX provides a more modern-looking GUI, but the library currently isn't very complete yet. Choosing one of these will require you to do some more additional research as every developer and projects have different requirements.


Every programming language has its strength and weaknesses, that's why choosing the right language for a problem could make a difference in terms of cost and time. That's all for this article. I hope this article is useful to you. Remember to share it with your friends if it is. Next tutorial will be on how to setup Java and NetBearn so stay tuned.

No comments:

Post a Comment