|Programming Paradigms||Object-Oriented Programming Language (Class Based)||Object-Based Programming Language (Prototype Based)|
|Type Systems||Strongly Typed||Dynamically Typed|
|Implementations||Compiled (static)||Interpreted (dynamic)|
|Environments||Any Virtual Machine||Client-Side Browser, Backend Server, Desktop Applications|
|Concurrency||Threaded Based Approach||Event Loop Based Approach|
A Very Brief History of Java
Java was developed by Sun Microsystems, and most notably by a programmer named James Gosling in 1995. The project was initiated in 1991 and took approximately four years to finish. The name ‘Java’ came about as a reference to the espresso bean, Java, and was conceived while James was drinking a cup of coffee. The purpose of the language was originally designed to be used for interactive TV but the technology was too advanced at the time for the digital cable industry.
Today, Java has a very wide array of applications, such as mobile development, web development, embedded systems, and desktop applications. Java has a saying, “Write once, run everywhere” which has held true over the years since its inception.
Java: Object-Oriented Programming
Object-Oriented Programming is a difficult concept to explain, so here is a great resource to get the gist of it.
Strictly enforcing OOP conventions may seem like a drawback but it is actually there to benefit developers. Enforcing common conventions makes it harder for developers to write poorly structured and unmaintainable code.
The downside to this is that it usually also means more boilerplate code. As Java requires at least one class for a program to execute. To get an idea of this, here is how to write ‘Hello World’ in Java
Java: Static & Strongly-Typed
A static language is synonymous with a compiled language. In a compiled language, the code is directly translated into machine code that can then be executed by the processor. The benefit of a compiled language is that it is generally faster and more efficient than an interpreted language.
You can think of this process as taking the Java code you write and converting it into code a machine can read (like your computer). Although Java code is fairly easy for a programmer to write, it isn’t easy for a computer to read and understand. This is why a compiler is needed.
In addition to being static, Java is also strongly typed. This means that variables must be declared with their data types. Once the variable is set with its data type, it can only be changed explicitly. For instance, if I want to make a variable that contains a number, I would write it like this:
int myNumber = 9;
While a string would be written like this:
String myName = "Grant";
var myNumber = 9; var myName = "Grant";
If you want to learn more about the difference between compiled and interpreted languages, this is a great resource.
Side Note: It is also important to note that the terms ‘strongly’ and ‘weakly’ typed languages are somewhat controversial in their exact meaning. However, it is generally accepted that it is more of a spectrum than two opposing sides. A language may be looser (weakly typed) about declaring data types or stricter (strongly typed).
As previously mentioned, Java had a philosophy of being flexible and universally used. For that reason, one of Java’s strengths is that it can be run in many different environments.
In web development, Java is conventionally used as the backend for many web apps. Java is also capable of being used on the frontend with technologies such as JSP, however, is not very common.
Java is also a very popular option for building desktop and mobile applications. As well as embedded systems. Which range from such devices such as GPS trackers, digital watches and blu ray disc players.
Obviously, Java is an extremely versatile programming language.
Threading And Concurrency
Java: Multi-Threaded & Multi-Threaded Concurrency
Multi-threading works by sharing common processing resources. Languages that support multi-threading have the theoretical benefit of increased efficiency. Since more than one task can be run at once, the program should take less time to complete.
Have anything to add to the article? Let me know below! I would love to hear from you. In addition, if you are a programmer that is looking to make some passive income, check out this article.