DEV Community

Cover image for Pitch me on Java
Ben Halpern
Ben Halpern

Posted on

Pitch me on Java

Continuing the series! Feel welcome to dip in and weigh in on a past question.

Let's say I've never used Java before. Can anyone give the run down of what the language does and why you prefer it? Feel free to touch on drawbacks as well.

Latest comments (60)

Collapse
 
drozdodo profile image
Dominika Drozdova

Hi All! I am recruiting for Java,C# and C++ roles fully remote if anyone is seeking a new role or looking currently!

Collapse
 
codewander profile image
codewander

My random impressions:

java community - bureaucratic over engineering
python, ruby, node community - under engineering
go community - enough engineering

clojure, scala, haskell, rust, elixir - more elegant, enough engineering

Collapse
 
s2rgi0 profile image
sergio

One of the pros could be that if a senior developer leaves you can almost get anybody to continue the proyect

Collapse
 
ant_kuranov profile image
Anton Kuranov

Pros

  • Type-safe: design and modelling, compile-time errors, IDE support, etc
  • Huge ecosystem: frameworks, tools, libraries, documentation, support, etc...
  • Reliable: developed and supported by industry-leading companies
  • Fast and stable on different workloads
  • Still in top of jobs vacancies
  • Medium entrance level => (mostly) experienced engeneers in your team

Cons

  • Oriented mostly to backend development, almost is not presented on frontends
  • Not so modern and contains a lot of legacy stuff, however the language is still now in active development of new features
  • Verbose: standard design patterns require a lot of boilerplate code
  • Memory consumption (there comes some optimizations like project valhalla)
  • Slow startup and "heating" time (may be critical). May be solved withcompilation to native code.
Collapse
 
gjorgivarelov profile image
gjorgivarelov

Ok Ben, let's say you've never touched Java. Which may imply you are an aspiring developer looking for a way to prove your competency. Java provides that pathway to proven competency by its certification series. You study and take an exam, you pass and hang a badge on your social media profile. You become proficient and build a portfolio. And then you showcase it to potential clients. Proof of competency taken care of.
You also learn object oriented programming. You learn about code reuse, inheritance, polymorphism which may be a novel approach to developing applications to you as an aspiring developer. Many educators of Java programming make their case for Java by comparing it to its predecessors C and and C++, so you get to learn about other languages along studying Java.
Number of job openings for Java developers might be an incentive to you as an aspiring developer to take the path of learning Java.
I will deliberately skip on arguing for Java on a technical level, that discussion won't have an end/conclusion. Pick a tool that'll do the job, and if Java can do it or if you are paid to use Java to do that job and you already are an accomplished developer with expertise and experience under your belt, nobody would have to pitch it to you.
Now for those of us learning Java just because, its platform-independence feature might look appealing. Execute the same code on either Mac, Linux or Windows, that may draw you in. Java, just by the fact it has been in use for so long, has built itself a steady following and a ton of documentation, it has been around for decades. Plenty of how-tos on the web regarding Java, if that is your chosen path to learn Java. Which then begs the question: once you think you get proficient with Java, what's the next step? Multiplatform feature has much less of an appeal now with the prevalence of cloud computing and the clear win for the platform agnosticism. Use Java for web apps like ye olden applets? Many other tools now exist much better suited for that task. Data science? Again, much better suited and better built tools exist for that field. IoT? Embedded systems programming? Those are yet more dead ends for Java.

 
leob profile image
leob • Edited

I've worked at a company where they had a gazillion tests and still the codebase was a disaster, lol ... use any great theory or technique in a wrong way, and you'll still suffer ... in many cases it's just about people needing to take their blinders off, and get out of their dogmatic mindset

Collapse
 
dukemagus profile image
Duke

Can i do a half-pitch?

Learn enough java so you can read and understand it, then learn Kotlin to write your own tools.

Java is verbose and clunky, but it has decades of tools, programs and libraries done and availiable, most of them open source.

Since Kotlin can use any java library and compile to JVM bytecode, you keep access to all the millions of developer hours Java accumulated while still using something lean and concise to write your own code

Collapse
 
rickdelpo1 profile image
Rick Delpo

Hi there fellow Devers.

I wrote a must-read Dev article recently on why we should all learn Java

click here at dev.to/rickdelpo1/why-would-i-want...

highlights

  1. we can learn just a little bit of Java
  2. it is a segway to SQL (acquire 2 skills by studying 1)
  3. beginners can be educated on REST api and JDBC quickly (fundamentals of request, response, get, post and hosting)
Collapse
 
fnh profile image
Fabian Holzer

Disclaimer: I am a card-carrying member of the Boring Technology Club and my pitch might sound a bit like "nobody gets fired for buying IBM", but Java is a total work-horse.

It is not pretty. It is not best in class. But it is solid and has you covered. But you can draw from a vast pool of resources, have plenty of software engineers with experience to hire, there is an abundance of libraries. Its ecosystem is mature. All the stuff that makes you productive is in place.

I build software for hospitals for a living. I like to sleep well. I use Java.

 
leob profile image
leob

Right, it's 100% 'YAGNI' ... I don't know what it is, probably it's just that people want to show off, they want to make sure that everyone knows that they've read "the book" ;)

Interestingly, this runs anathema to TDD - because TDD teaches us to implement "the simplest thing that works", AND because TDD provides a safety net that allows us to implement that pattern or that abstraction if and when we need it ...

TDD is sound and solid practice, the over emphasis on complex OO modelling is not.

 
leob profile image
leob

Spot on ... Smalltalk (what I've seen of it) is brilliant, it's OO as it was intended to be :)

 
leob profile image
leob

Oh yeah that bothers me as well, the incessant urge to overcomplicate everything ... I'd want to say to the average Java dev, can we just do "KISS" for once, the simplest thing that works - but no, the thick Patterns bible (GoF) is never far away, because everything MUST be abstracted to death ...

Collapse
 
thorstenhirsch profile image
Thorsten Hirsch

Pros:

  • fast
  • much tooling, big ecosystem, especially for enterprises
  • suitable for big projects
  • brought us the JVM (which now is the base for many more languages)
  • tiny native binaries with little memory consumption are possible

Cons:

  • its OOP approach has spoiled so many developers
  • verbose syntax, especially for some creational design patterns
  • sometimes still memory-hungry
  • trademark is owned by Oracle
  • desktop app development is problematic (e.g. several competing UI toolkits)
  • java-in-the-browser once was a thing, but has died
  • take a look at Kotlin, it might be the better java
Collapse
 
abhinav1217 profile image
Abhinav Kulshreshtha

If you learn Java, you will become a good developer in any technology stack you want. It is strict, verbose, has a fixed way to do stuff. It has strict guidelines about coding styles. All these extra lines of code that you type to configure things, the lack of behind the scene magic, will enhance your concepts to a point that it will become a second nature for you. And then, when you work on any other tech stack, these basic skills will become foundation of your work.

In India, recruiters prefer students with java background, Not necessarily because they work on java stack, but because they know that these students will have a clear concepts, and can easily learn to work on any stack they are provided with.

I have personally experienced, that students who just learned nodejs, were not able to architect their apps in a scalable manner, Few of them don't like typescripts because they think strong typings doesn't have much benefits. They have excellent understanding of JS, and their frameworks, but can't transfer their knowledge on other stack if needed.
The students who had java as their background, it was their second nature to know how to split code into meaningful, reusable modules. They name their functions in a meaningful way. They write docblocks. And they can easily transfer and translate their skills to any stack they are given to work with. Node, PHP, Go, Dotnet.

Collapse
 
leob profile image
leob

Probably what you abhor is the verbosity - that got quite a bit better with the most recent version(s), but still ... there's also a culture in the Java world of being in love with 'patterns', with layers upon layers upon layers, and with over-engineering in general ... I worked with Java for a long time, but for me moving to other languages and ecosystems was a breath of fresh air.

Collapse
 
liamjoneslucout profile image
liam-jones-lucout • Edited

You've really hit the nail on the head here. I'm working with a Java dev on a Typescript project at the moment and he's really struggling to get out of this mind set. Especially wrapping everything in a class

Thread Thread
 
leob profile image
leob

Yep ... :)

First thing he needs to do is forget and unlearn the heavy OO baggage, and throw that thick "patterns" book (the infamous "Gang of Four") out of the window ;)

Collapse
 
codewander profile image
codewander

test induced design damage

Thread Thread
 
leob profile image
leob

Lol and that is? TDD (if that's what you mean) is generally a commendable technique, it's not necessarily the reason why all of the Java software got so complex, it's more the mindset that everything needs to be infinitely generalized and abstracted to death, even when there's no reason to do so.

Thread Thread
 
codewander profile image
codewander

dhh.dk/2014/test-induced-design-da... - that was the article that got me thinking that hexagonal architecture, which I first encountered in reading about java (and scala) patterns, was part of a pattern of over engineering in some circumstances.

Thread Thread
 
leob profile image
leob

Ah right, interesting article ...

The problem is the misconception that all tests must be "unit" tests in a pure sense - no database, no I/O, only calculations ... that's of course nonsense and impractical, and that's not what TDD says.

If you accept that a large part (the largest part) of your tests just execute web requests (but without talking to a real web server over the network), and use a (test) database, then TDD can still be applied perfectly well without having to use Hexagonal or such extreme stuff.

So I'd say don't blame TDD, blame people who don't understand how to implement it in a practical way. Oh and Hexagonal Architecture is cool and interesting, and very relevant ... for less than 5% of all apps/systems ;)

(the 5% is almost certainly an exaggeration)