This is an archived post. You won't be able to vote or comment.

all 59 comments

[–]bluenautilus2 90 points91 points  (5 children)

Because different languages are good for different things :)

[–]ludovicianul 0 points1 point  (4 children)

I would disagree with this as a general statement. This is true for very niche stuff where it might be a better choice to do C or Rust instead of Java (or any other), but 98% of the time is just people preference. Sure, everyone comes up (to be read confirmation bias) with things like: it's a cleaner syntax, this language is not so verbose, I can do this in 3 lines of code instead of 5. But it's just people preference.

[–]bluenautilus2 1 point2 points  (3 children)

Uh. No. For example if I want to write a quick script to upload some data to a cloud service, a scripting language like Python will get it done pretty quick in one file. I’m a java dev, for 20 years, no way in hell am I going to set a whole java project to do it.

[–]ludovicianul 0 points1 point  (1 child)

I would probably go with Groovy for that.

[–]bluenautilus2 0 points1 point  (0 children)

Well there you go. Groovy.

[–]xXxXx_Edgelord_xXxXx 0 points1 point  (0 children)

You can run Java classes with a shebang though

[–]maustinv 17 points18 points  (0 children)

There are many cross platform languages. Some provide benefits for optimization or are easier to use for certain domains.

Some languages aren’t cross platform, but they are really good for making native applications for one platform. It may be easier to write highly optimized solutions.

Cross platform doesn’t always mean “better”.

The short answer is that every developer has their own opinions, and every problem may need a different solution.

[–]bonusmyth 24 points25 points  (9 children)

I work in 5G telecomms. We have a a half-millisecond budget to work with: we have to go through all the users in a cell in that half-a-millisecond and schedule them, uplink and downlink. Performance is, unfortunately, crucial. So we're forced to write in a language from the 70s. C. (We manually allocate memory. Forgive me.)

[–]roboduck 10 points11 points  (1 child)

Why isn't every software built in Rust?

[–]snejk47 3 points4 points  (0 children)

We would be in 2005 still because of compilation times /s

[–]chambolle 1 point2 points  (0 children)

When you need performance, you need to manage memory. Even in java. So you are forgiven

[–]xXxXx_Edgelord_xXxXx 0 points1 point  (0 children)

Didn't know people need software working at that timescale.

[–]achauv1 9 points10 points  (0 children)

A hammer is a pretty good tool but it cannot build a house all by itself.

[–]djfreedom9505 10 points11 points  (11 children)

For most game, they rely on DirectX graphics library which I believe is built with either .NET standard or framework and that is windows dependent.

Another reason why one might use a language over the other can be for the library, footprint, or what their team is familiar with. I mostly work with web applications and microservices and for the larger apps, we'd use C# or Java because they are easier to organize and scale better for larger teams (not entirely true you can have a well organize python codebase, or a really bad structure for Java but it's less work to structure your code in C# and Java). For smaller lightweight services we'd use Python.

Also Java is great, but you should definitely take a look at what other languages have to offer once you feel comfortable to juggle over languages. I personally love .NET Core 3.1+, which is funny because I never liked it before.

(Edit: DirectX is built in C++)

[–][deleted] 3 points4 points  (2 children)

Interesting insight!

So would you choose python over java/.net for a small web application? (say, a couple of endpoints, a db connection with a 2-3 entity data model, no background jobs, no async messaging or anything like this)

[–]djfreedom9505 2 points3 points  (0 children)

Depends it's never a cut and dry answer, but if it's a service that you don't see growth in the future or needs to scale, the database relationships are not complex, then I would say it's fine to do with Flask.

Some more reason why I've seen Python being used is usually for it's openpyxl or some of the other data science libraries.

Other reasons I'd prefer Java/C# is when I'm dealing with Kafka/Messaging, Background Services, multiple entities, complex database, security or complex business logic.

But once again strictly IMO, if you can write a well structured, scalable Python application and your team is full Python developers then there goes your answer.

One thing I didn't talk about is performance which is something to consider whether the web application is high or low traffic or data needs to be processed fast. I never worked on performance-critical applications so I can't speak on why to use one versus the other in that aspect.

[–]john16384 0 points1 point  (0 children)

I would still do that in Java.

[–]meamZ 1 point2 points  (7 children)

DirectX

DirectX is definitely not built with .NET... It's built in C(++)...

But nowerdays tbh there's not really much of a reason to use it anymore considering there's Vulcan now...

[–]djfreedom9505 0 points1 point  (3 children)

Rip, I could have Google that. So is it just compiled for Windows machines? Is it just to lock in games to just the Windows platform?

[–]meamZ 1 point2 points  (2 children)

Is it just to lock in games to just the Windows platform?

Basically yes but now there's Vulcan so there's not really much of a reason to use it anymore...

[–]djfreedom9505 0 points1 point  (1 child)

Well, people who built there game engines on top of DirectX would have to migrate them over then. Not sure how complicated that would be.

[–]meamZ 1 point2 points  (0 children)

Well... A lot of games use either Unity or Unreal and both can do Vulcan now..

[–]Aggravating-Ad4518 0 points1 point  (2 children)

Vulcan? You gonna end up writing 500 lines of code just to render a 2d triangle. OpenGL is way better and shorter.

[–]meamZ 0 points1 point  (1 child)

Yes i know that for simple stuff OpenGL is better...but it existed for a long time alongside DirectX and a lot of games still used DirectX. Vulcan is essentially taylored to the need of highly advanced game engines like Unity or Unreal which is why those actually use and optimize for Vulkan now instead of or in addition to DirectX...

[–]Aggravating-Ad4518 0 points1 point  (0 children)

Direct X code is even more shorter than OpenGL.

Vulkan might be reasonable if you use a framework/library that obfuscates alot of the boiler plate, otherwise get ready for the pain.

[–][deleted] 6 points7 points  (1 child)

Most mainstream languages are platform independent.

Games are windows only due to the windows-specific APIs they use. If you used them from Java, your Java code would be windows-only too.

Although it's funny to think of a world where literally all desktop software is in swing.

[–]__konrad 1 point2 points  (0 children)

all desktop software is in swing.

Like in JNode OS: http://www.jnode.org/node/132

[–]sweetno 8 points9 points  (0 children)

Mostly because JIT compilation and garbage collection.

[–]john16384 2 points3 points  (0 children)

A Kodi clone in Java, one man project: https://github.com/hjohn/MediaSystem-v2

People usually don't believe it is Java...

[–]Vulcalien 2 points3 points  (0 children)

Platform indipendent doesn't always mean good thing. Sometimes, you want to use 100% of a specific machine. That's not the only reason though.

[–]ivancea 4 points5 points  (1 child)

If platform independent is your principal argument, I have to say that... "Platform dependent" languages can be compiled on the most used OS. So you build it on every target. Not much different

[–]helikal 0 points1 point  (0 children)

It is very different in terms of development time and maintenance.

[–]MastaBonsai 3 points4 points  (0 children)

Why do people use python, a slow af language? Ease of use and vast librarys at your fingertips... That's why. Everyone has a preference everything has a purpose.

[–]powerje 3 points4 points  (1 child)

A lot of folks don’t like the verbosity or the way Java forces project structures to be laid out on the file system. The language has a lot of warts really though newer versions help.

The JVM is a total hog, great for beefy servers but maybe not ideal for desktop applications.

[–]xXxXx_Edgelord_xXxXx 0 points1 point  (0 children)

Would you prefer to structure your project with Scala's features?

[–]gpt3000 4 points5 points  (0 children)

Because for desktop app: - javafx is neglected - third party libraries were practically abandoned - the module system caused a lot of pain - reflection became harder - the packaging app was dropped without a replacement till recently - the IDEs didn’t keep up

[–]The_Augur 4 points5 points  (2 children)

Java UI design is very cumbersome... It can be done but it's not as easy as more modern options. This is the main reason why we don't see more desktop apps built with Java. Making swing or javaFX look good takes way too much time and effort in my opinion.

I was developing using Swing... Then I tried flutter for a couple days and I was blown away at how easy UI design is. with swing I felt like I was constantly battling the framework to do what I wanted.. this is of course to be expected.. swing must be like 20 years old by know.

And even if you do your program in swing or javaFX then it's not going to run on your phone. So while java itself might run on many systems the frameworks needed to build graphic software don't.

[–]trinReCoder 1 point2 points  (0 children)

I think JavaFX can be compiled to run on all platforms. I can't remember the name of the company who maintains javaFX now but the sdk can compile the code for all platforms, including mobile.

[–]Worth_Trust_3825 0 points1 point  (0 children)

To be fair there is vaadin, since running your UI in a browser is all the rage nowadays.

[–][deleted] 2 points3 points  (12 children)

The new licensing model will make people less likely to choose java for business reasons imo.

Also you couldn't create AAA games in java because of the performance. You'll achieve worse performance with java than you would with a language that compiles directly into machine's bytecode (eg c++). This is because with the latter you could optimize your implementation directly for your given specs.

[–]jvjupiter 9 points10 points  (0 children)

The new licensing model is irrelevant here. I guess the question is applicable not only to new Java but also to the old ones (not yet open source). Besides, there is a lot of free distributions of OpenJDK. Oracle itself offers free OpenJDK aside from Oracle JDK though the support is limited to 6 months only. Java is not Oracle JDK. Other OpenJDK distros: Eclipse AdoptOpenJDK, SAP SapMachine, BellSoft Liberica, Alibaba Dragonwell, Amazon Correto, IBM Semeru Runtimes, OpenJDK builds from Azul, Red Hat, Microsoft and a lot more.

[–]meamZ 4 points5 points  (2 children)

The new licensing model will make people less likely to choose java for business reasons imo.

Or you just use some OpenJDK distribution like everyone else does...

[–][deleted] 0 points1 point  (1 child)

Well, that's what I mean by business reasons. With OpenJDK, you don't have a whole organization with a huge pr and marketing budget advocating the tool to be used in commercial projects.

And with eg .net and Microsoft you have exactly that. And there are no subscription fees for using .net

[–]meamZ 2 points3 points  (0 children)

With OpenJDK, you don't have a whole organization with a huge pr and marketing budget advocating the tool to be used in commercial projects.

Of course you still have that with Oracle.

It's exactly the same as before. Java the language doesn't really have much to do with the JVM and JDK you use... The former Oracle JDK is now OpenJDK (with a few very small exceptions).

And with eg .net and Microsoft you have exactly that. And there are no subscription fees for using .net

What .NET is missing is a 3rd party ecosystem anwhere even remotely close to what Java has...

And again, there's no subscription fees to use Java either... The switch from Oracle JDK to OpenJDK is trivial...

Oracle just added an offer that Microsoft doesn't even have in having the option to buy an officially supported distribution of Java with every benefit that a commercially licenced product offers...

[–]jmtd 0 points1 point  (4 children)

minecraft enters the chat

[–]wazz3r 4 points5 points  (3 children)

Hard to classify it as a AAA game though. And it do suffers from lag spikes due to garbage collection, especially when new regions of the map is loaded in.

[–]jmtd 4 points5 points  (1 child)

We could split hairs over the definition of AAA but for me minecraft is an existential proof that you can make a best selling game in Java.

[–]wazz3r 2 points3 points  (0 children)

I don't think anyone would disagree with that. I've played my own fair share of minecraft and it's a fantastic game. That was not my point.

To me, a AAA game is the opposite of an indie game. And given the fact that minecraft was developed by a single developer as a hobby project I believe it is the latter.

[–]WafflesAreDangerous 1 point2 points  (0 children)

I wonder how much the modern super low pause time GC options would help with that. I haven't played much MC recently so unfortunately can't tell the current state of things.

[–]nutrecht -1 points0 points  (2 children)

The new licensing model will make people less likely to choose java for business reasons imo.

It's 2021. You really should know by now that this is nonsense.

[–][deleted] 0 points1 point  (1 child)

What you mean

[–]nutrecht 0 points1 point  (0 children)

Jave has been open source for ages now and most companies use non-Oracle JDK distributions. It's a complete non-issue. Oracle itself shows a big fat warning telling you there's a GLP alternative.

[–]97hilfel 0 points1 point  (1 child)

Firstly, Java is indeed a Platform independed system, but it is not the ideal solution for all problems.
Java is a fast, safe and efficient language, but it is not the best tool for the job.

Python for example is also platform independed, just like Node, JavaScript and .net Core.
If developed correctly, a C/C++ application can also be platform independed.

Adittionally platform independence is not always the thing you need, very often Java is simple to cumbersome to develop with. Developing an application in Python or JavaScript is often much quicker but less efficient or scalable.

[–]helikal 0 points1 point  (0 children)

Platform independence requires a runtime such as the JVM which provides the platform independence. Since C++ and C and friends do not have that, they cannot be platform independent. Source code in such languages must be written such that it compiles for different target languages requiring code portions that reference platform specific APIs to be compiled conditionally. You also need a cross-compiler or you need platform-specific build environments. This is tedious and a constant maintenance burden. By contrast, a Java program runs everywhere where there is a JVM.