DEV Community

Cover image for Why I love Java
Arik
Arik Subscriber

Posted on • Originally published at Medium

Why I love Java

Java is unarguably one of the most popular programming languages in the world today. Companies like Google, Amazon and Netflix -- to name a few big names -- are using Java to build large portions of their infrastructure and backend services. But despite its huge popularity (or perhaps because of it) Java's reputation among programmers is something of a mixed bag. Some seem to genuinely like it while others hate it.

Personally, as someone who has been using the language for more than a decade professionally, I find it to be an excellent language. No, it isn't perfect. And the programming world -- being young as it is -- is still learning from its own mistakes. But all other things being equal I think that Java got a lot more right than wrong.

Following are some of the things I think Java got right:

It's a productive language

As a programmer I get paid to solve problems. In minimum time and maximum quality. My software is expected to be robust (bug free), performant and maintainable (easily extended). I typically write large, distributed and fairly complex server-side software.

Java is a purely Object Oriented language. To the uninitiated, this means that you design your code around unit of codes called "objects" which loosely resemble real-world object (or concepts). So if you were to write, say, a library management software you'll most likely have these code objects representing books, members, staff but also more abstract concepts such as genre and loan.

This happens to be a very neat way to organize software (and your thoughts). Instead of thinking about your system as a big line-by-line, step-by-step algorithm, you think of it as a set of interacting objects. If done right, each one of these objects can be reasoned about independently from other objects. Each object can be tested in isolation from others and each one can be extended without necessarily affecting the entire system.

Java did not invent the idea of Object Oriented Programming. In fact OOP dates back to the late 60's, but the Java language designers did a great job implementing the idea in the language in such a way that it is practical and productive for the programmer.

The Java Virtual Machine

One of Java's most convenient features is the Java Virtual Machine (or JVM). The JVM essentially acts as the translator between your Java code and the particular operating system that your code is running on. This is the origin of the once-famous Java marketing slogan "write once, run anywhere". Without the JVM, you'd have to compile your code for every operating system separately. the JVM guarantees that your Java code runs identically on Linux, Mac or Windows.

The Java language designers also envisioned a world where other languages can execute on the JVM besides Java. To that end they've specified a low-level language (called "bytecode") which is the language that Java complies into and the stuff that actually gets executed on the JVM. Today there are dozens of languages targeting the JVM as a result.

Automatic Memory Management

If you ever used a language such as C or C++ then you are intimately familiar with the painstaking effort involved in manually managing memory allocation (and deallocations) in your programs. This is an area, so rife with bugs that the designers of the Java Programming Language decided to do away with it completely. Rather than giving the programmer the opportunity to shoot themselves in the foot they decided to let Java do all the memory management for them -- automatically.

In Java, the programmer simply creates whatever objects they need (without explicitly worrying about allocating memory for it) and Java will automatically reclaim that memory once the object is no longer used by the program.

Standing on the shoulders of giants

Java was designed and implemented by some of the brightest people in the Computer Science world. People such a Doug Steele, Joshua Bloch, Mark Reinhold and Brian Goetz are true masters of their craft and are a constant source of inspiration and learning for me. Not just about Java per se, but more importantly, about writing better software in general.

Huge community

As of this writing, according to Wikipedia, there are 9 million Java developers around the world. This is a huge advantage because for just about every problem you run into as a developer there is a high likelihood that someone, somewhere had already solved a variation of this problem or that very same problem. Usually a simple online search will reveal multiple sources that can be used to solve or at the very least approach the problem.

Fantastic frameworks & libraries

Java has an enormous array of frameworks and libraries to choose from. From logging, to web development, to database connectivity, to messaging clients, there's a library (or several) to help solve just about any problem. A particular favorite of mine is the Spring Framework which had become the defacto framework for any sort of work involving web (HTTP) technologies.

Writing web application using "raw" Java would be a tedious task, to say the least. Moreover, the designers of Spring noticed that many programmers are trying to solve the same (or very similar) problems and each one is solving these problems slightly differently. Spring (and its vast portfolio of sub-projects) are meant to give the programmer a leg-up by giving them a solid set of building blocks to build upon for their projects.

Closing thoughts

There are many fine languages to choose from out there. Java is just one of them. This article is in no way trying to claim that "Java is the best" or that "Java is better than X language". It is simply meant as an acknowledgement to the fine work that made Java possible.

Latest comments (31)

Collapse
 
shaijut profile image
Shaiju T

😄, I used to have questions like which language is better ? After discussing with my friends and listening to people online, I realized that Its better to stop asking these questions. Instead start asking which tool is better for current Job and Trend.

Choose the right tool for the Job.

  • Based on your experience, you can use C# or Java for building enterprise and large applications.
  • Instead JSF you can think of using Anuglar orReactorVueetc. for Front End.
  • Python for Machine Learning.
  • Go for Micro Services based performant applications.

In future maybe today's Languages and Framework may be outdated, so to survive you will be forced to learn new language of that time.

Conclusion:

  • Developer Happiness, stick to the language which make your life easier, like easy to read syntax, maintainable, has Good IDE. I like C# for current work, and its up-to you to decide what you like.

  • Its always good to be Open to learn any language as required and Choose the right tool for the Job.

Hope this helps.

Collapse
 
andevr profile image
drew

I'm recently learning Java after struggling for a long time to learn JavaScript. I chose Java over Kotlin because I wanted the best chance of getting a job with my first language (way more available jobs) while also positioning myself to eventually learn kotlin/android development if Kotlin eventually takes over or becomes more prevalent. Java has been such a joy to learn, I've made way more progress with it than I ever made with my early attempts to learn a language.

Collapse
 
acoh3n profile image
Arik

That's really cool. And I totally agree on all points. Java is a great choice career-wise because it's in very high demand. It is also a pretty simple language and not overly loaded with features -- which to some might seem as a shortcoming compared to other languages -- but personally, I think that its simplicity is one of the language's biggest strengths. Good luck in all endeavors!

Collapse
 
andevr profile image
drew

Thank you. I think the simplicity is part of what draws me. In a lot of ways JavaScript was very complicated, and the lack of exercises in 99.9% of JavaScript learning material aimed at completely new people is more a hindrance than anything. Java is definitely more my speed, and having multiple opportunities to practice has made it a much better experience.

Collapse
 
saraalfred profile image
Sara Alfred

I personally like Java but as I am of not this field I am not having enough command in it. My UK based company also use JAVA for backend services. Thanks for sharing this motivating article

Collapse
 
acoh3n profile image
Arik

Thanks for the nice feedback

Collapse
 
parambirs profile image
Parambir Singh • Edited

The best part about JVM is the community. However, Java is an okay language. It's possible that people 'loving' Java are suffering from Stockholm syndrome! :D

Collapse
 
acoh3n profile image
Arik

or maybe they just like the language.

Collapse
 
silverhusky profile image
SilverHusky • Edited

This is actually an excellent summary for Java one of my favorite.
More importantly this article give us a different perspective about its pros. Cool to save.

Collapse
 
differentsmoke profile image
Pablo Barría Urenda

I have never used Java, but this was something of a red flag to me:

To the uninitiated, this means that you design your code around unit of codes called "objects" which loosely resemble real-world object (or concepts).

I'm a self taught dev, and I REALLY struggled with understanding Object Orientation early in my career. I once came across an article on "worst advise rookie programmers get" and listed in it was that this idea that "Objects are like things in the real world".

I'm really not trying to be a hater, but reading that that was a bad way of thinking about objects was the beginning of my grokking object orientation.

Collapse
 
shryne profile image
Eugen Deutsch

If you are writing library management software, your software might have units like "book", but also a "Manager", "Controller", "Utils", "Helper" or a "Service". I still don't get, how a "Controller" is a real-life entity, but to be fair I am also not sure If I can blame java for that.

Besides, since you like Spring I wonder how you could say that Java is purely object-oriented. At least it gives Spring enough room to not be object-oriented - leaving aside whether you actually care about it or not.

Collapse
 
henry701 profile image
henry701

Java is not purely an Object-Oriented language. It's mixed. Still, i got the point.

No points there about Java are wrong, but what i found is that most of the other similarly-used languages get those points right better than Java 90%> of the time. And when people compare it to other languages, that's why it comes out bad.

When comparing Java to C#, for example, i found it outdated because there are many features that really make developing more productive and code cleaner and that are purely syntax sugar, but Java does not implement those at all.

Collapse
 
tomerbendavid profile image
Tomer Ben David • Edited

I love java, I used Scala, JavaScript, python, R, typesceipt, Ruby, haskell, closure, and more professionalky. Computer language is just a tool, the product, system is the main thing and where the real challenge compelexity lays.

Collapse
 
remify profile image
Rémi B

I can't love Java because of other languages. Java is good and it can do many things but it doesn't shine anywhere it use to.

Collapse
 
stealthmusic profile image
Jan Wedel

Fun fact: Java is not a pure object oriented language. int, float and other primitives are not objects. Moreover, objects actually should should not be able to mutate state of other objects directly (foo.bar = 3) but using messages (aka method calls).

In Python for example everything is an object. Numbers, strings, lists, functions, modules, code. Doing stuff like foo.bar = 3 actually calls a method in the background.