DEV Community

Cover image for Which language do you think has a better future: Java or Javascript?
l222p
l222p

Posted on

Which language do you think has a better future: Java or Javascript?

I remember a couple of years ago I was in class and a colleague asked to our professor: Which language do you think has a better future? The professor started explaining how diferrent they are, what can you do with them or which one you should use in your project. At the end, didn't answer his question.

Right now, that question came up in my mind in terms of carrers, I prefer Java since is a robust language and I had the opportunity to work with it rather than Javascript. But how do you think would be the Future of Java? What about Javascript?

I believe that Javascript has a better future since you can build almost everything with it and most important there is a huge community which can implement it: front-end apps, back-ends apps, desktop apps and mobile apps of course with their corresponding framework. I know with Java you can do it as well , that's why I'm trying to compare them (except a front-end app, as far as I know).

What do you think the future of a Java developer will look like? a Javascript one? Can Spring Boot beat NodeJs? Can JavaEE beat ElectronJs? Can Kotlin beat React Native?

I look forward your answers.

Top comments (5)

Collapse
 
daleran profile image
Sean M Davis • Edited

It sounds like your professor gave the right answer.

Those languages are not mutually exclusive nor really against each other. Why not both? If you want to work as a web developer you will probably need to know several languages. You need JavaScript to do anything in the browser so if you are a web developer you will need to know it pretty well regardless of what the back end is.

Also, even on the backend Java and Node are really used for different things.

Node is great at I/O. It is also lightweight and quick to develop with. It sucks for anything that is going to be computationally expensive. Also, larger apps are harder to design well. JavaScript is pretty unopinionated so it gives you a lot of rope to hang yourself with. It is really designed to get a request, route it, and send back the response.

Java and its cousin C# are both enterprise-focused backend. Finance, healthcare, and government use it to build large enterprise-grade web apps. Java really excels at computationally heavy workloads that would make a Node server grind to a halt. It also is the quintessential object-oriented language. I would say Java's main alternatives are C# and maybe Go or Rust in the future.

PHP is also pretty prevalent so there is a decent chance you might end up working in it one day whether you want to or not. PHP actually isn't as bad as people say it is. It has a goofy inconsistent syntax but it is a capable backend. Don't learn it as your first language but don't rule it out later on down the line in your career.

JavaScript and Java are going to exist side by side for some time. They work differently and have a lot of different use cases.

I would say learn one of the popular languages and learn it well. Then move on to the next language. JavaScript is a must these days if you need to do browser work so I would learn it. Until web assembly is ubiquitous, JavaScript is a must. Then, try learning a backend language. I would try to pick a language with a different paradigm than you know. You will learn a lot more if you learn several paradigms (strictly typed, dynamic, imperative, declarative, functional, event-driven, object-oriented, etc).

Eventually, you will start to understand the underlying abstraction of programming and the language becomes just syntactic sugar.

Collapse
 
l222p profile image
l222p

Thanks for your answer!

This question came up in my mind because I had the opportunity to study and work in Europe. I noticied most companies look for Java developers, It was interesting for me because in my country is the opposite, most Javascript developer.

Collapse
 
daleran profile image
Sean M Davis • Edited

Big companies mean big enterprise projects and that means lots of Java jobs. Europe (and the US) both have lots of large enterprise companies. Pull up any job board in those countries and Java is probably the most demanded language by job title.

Collapse
 
daleran profile image
Sean M Davis • Edited

JavaScript also has automatic memory management. Almost every modern language has automatic memory management with the exception of C and C++. And memory management usually hides a lot of complexity.

JavaScript is also pretty easy to learn and get started with. However, it is also easier to develop bad habits. It is fairly unopinionated and lets you program however you want which is a double-edged sword. Java imparts some structure and can be easier to work in with large codebase and large teams. I think it will stick around in enterprise for quite some time. It will probably be what COBOL is today. 30 years from now Java developers will make a fortune debugging 50 year old government apps.

JavaScript can get messy fast. That is why TypeScript is so popular. It imparts some structure and transpile time checking. A lot of teams have used Typescript for large projects.

Collapse
 
zizaco profile image
Zizaco • Edited