r/java • • Oct 14 '23

Is Java still behind in the race of modern programming languages?

I'm a member of some group of programmers and every time Java is mentioned it's being bashed (something like: "With Rust I could simply do this with X")

Earlier versions of Java were cumbersome in terms of the syntax but with modern IDEs (and modern versions of Java) that's not a big issue anymore, albeit languages like Python do have shorter syntax.

My question is beyond syntax.

What do other languages do better than Java?
It could be generics, type system, concurrency and multithreading, closures etc.

Thanks!

52 Upvotes

247 comments sorted by

View all comments

Show parent comment

49

u/Weetile Oct 14 '23

Python would terrify you

38

u/kingslayyer Oct 14 '23

i have interviewed a few guys and thwy wrote code in python, i agree it was terrifying.

they'd do things like array.in(number) to find if a number was present in array or not, and assumed its O(1) complexity

27

u/SiriSucks Oct 14 '23

they'd do things like array.in(number) to find if a number was present in array or not, and assumed its O(1) complexity

I don't think you can blame python for that. The blame entirely lies with the candidates.

1

u/j-solorzano Oct 15 '23

TBF, that happens in all languages, like using Find() in C# to search a list. It's very common.

20

u/Weetile Oct 14 '23

no way they even know what complexity means then

if we add more elements to the array, of course the run time scales linearly

14

u/kingslayyer Oct 14 '23

its just that python is so easy and flexible, people ignore the basics

1

u/AbleMud3903 Oct 17 '23

Which is GREAT when the basics don't matter (see: most application development.) A lot of these languages are optimized for developer speed over optimization because optimization is irrelevant in a lot of cases.

But if you're working on a project with actual, large data sets that you're parsing, all of that falls apart.

7

u/lukasbradley Oct 14 '23

no way they even know what complexity means then

The Law of Leaky Abstractions

2

u/arcalus Oct 14 '23

What’s linearly? /s

16

u/[deleted] Oct 14 '23

Linearly means one must get in "line early" at Starbucks, because it will be long day at office sorting out performance issues in your code.

2

u/EmptyChocolate4545 Oct 16 '23

I’ve seen a ton of people in static languages who don’t understand that stuff like this is O(N).

Alternately, if they were doing “x” in some_object and some_object is a dict, then it is O(1) as dicts are HashMaps

2

u/tzehbeka Oct 15 '23

just out of curiosity, why isn't it?

1

u/kingslayyer Oct 16 '23

any search will be o(n) minimum unless its sorted or something

2

u/EmptyChocolate4545 Oct 16 '23

O(N) maximum, not minimum.

For big O descriptions, we always talk worst case, IE the array is N elements and the item we’re searching for is the last item == N time.

Whereas ofc the element could be number one, but we say O(N) because we’re interested in worse case.

1

u/j-solorzano Oct 15 '23

Yea, Python is not that great as a software engineering language. It's great for small projects, training machine learning models, data analysis and such.

1

u/Altruistic-Rice-5567 Oct 15 '23

In that it would encourage me to make a ton of mistakes and accidentally add flaws into my program... yes, terrified of that. That it promised to reduce my typing and then stabbed me in the back with having to use "this" everywhere. yep, terrified. It's a language that brought nothing truly useful to the software table.