Why I Love Java

I’ll give you an in depth play by play later. Wrapping something up right now.

1 Like

Nah, there’s an overhead for the JVM, the way it manages memory, etc.

There is “good performing” (for java) code and then there is non-JVM code…

Most of the heavy lifting in any “good perfoming” java app is done by the frameworks/system libraries that sure as fuck aren’t written in Java.

Times change. when i was in uni our first language was Pascal (which i already knew and had been using in-line x86 assembly with for my own mode 13h VGA graphics library in high school - we were learning about pointers and linked lists in that first Pascal class). The second language? 68hc11 assembly.

Most performant java applications are just glue logic for a bunch of highly optimised system libraries written in C/C++. Which, in 2019 is fine i guess. But it’s not java doing most of the work.

Not very well.

I put a target on my back. Granted, I screwed up and let it slip. It could have been worded a lot better and I could have waited for a better time and place, maybe. There were some people that responded very poorly, criticizing everything from my job role, my education, etc. Others were more passive aggressive, asking for my input on some development decisions and then criticizing harshly when they didn’t agree or I wasn’t with the majority opinion.

That lasted for about two weeks. After that, the DevOps manager and software engineering manager told them to STFU and start getting on the bandwagon. We were spending over $600,000 a month on AWS costs. From there, the actual planning and involvement of the team I was on started. We did little things at first, like shutting down developer instances from 11 PM to 7 AM. Other things involved load testing, so we could see how autoscaling would happen. From there we had metrics and telemetry to show what was causing the issues. Majority of it was SQL query/business logic/backend related, but quite a bit was optimizing control flow and trimming down decisions and loops. Unfortunately, I wasn’t involved in a lot of those optimizations, but I did preform the load testing and provide the data for the development team.

Yeah dude, we had a huge issue with that. Rather than use a small third party or import something they’d write their own and integration would go to shit.


I could relate to this guy probably more than most :wink:

10 Likes

Yeah man, I definitely get the vibe you’re going for.

Java is a lot more accessible than some of the other languages out there, so it’s going to have more of a developer base. It’s why JavaScript gets a bad rap, in my opinion. The easier it is to use, the more developers it attracts, the more “bad” systems there are in the wild.

I think the issue in my situation was a mix of being tied in their ways and, for a lot of the developers, this was their first job after college. We had a 10:1 junior to senior dev. And the team was only like 15 people :wink:

1 Like

Actually, seems like Java (can) in rare cases actually outperform c++. Reasons being the JIT compiler can optimize the resulting machine code that is being executed for the data you are shoving threw your code. C++ can’t do that, because it compiles to machine code that you cant change at runtime.

Im not saying its actually gonna be faster. C++ will continue to be faster more often than not.

Graal is also quite a bit faster than the old JIT compiler. Could be that you get quite a bit of performance out of your Java code bases just by using it.

Twitter presentations are a good place to look for information about graal (and JVM things). They are getting some hefty savings appearently by employing people who work on the JVM.

Java has it’s applications. Must admit though, I am really not a fan.

Personally, I never used Java outside university, 20 years ago now. In uni it wasn’t half bad of a choice. Out of 20 or so people in class, probably 2-3 knew anything about programming, and only one knew about object oriented programming.

Problem isn’t the language as such, it’s the way programming is taught. Programming language is chosen, and students learn to use this language, not actual programming outside a few basic concepts. Which leaves us with a rather large issue. Shitload of “professionals” which, in large parts, are only able to use predefined frameworks.

At work at the moment, I’m developing a series of products, alone. This involves, hardware design and prototype manufacturing, client/server software design and production thereof, servers from design through purchase and installation to maintenance afterwards. In other words, every technical aspect involved in this project is my responsibility. My boss had a very hard time finding anyone that was able to do this, in the end, he was looking at having to hire 3-4 people. Not because the task was too big, but because there are disturbingly few that are able to do more than one of the above mentioned areas of the project at a time.

Personally, I don’t understand how a programmer is unable to use a terminal and setup his own server to run his web app, configure and maintain his own database server, or whatever is needed. The more you know about your platform, the better you are at defining the project you have to do. A developer that doesn’t want to open a terminal, start learning and get better, is not one worth keeping employed, it’s someone that’s prone to taking the easy way, and will probably not advance much outside the already chosen field/language. Which is kind of useless these days, especially at the rate we’re progressing.

Alas, at the end of the day, it should be irrelevant which language is used, depending on situation of course. It’s about writing good code in any language, which gets the job done most efficiently.

5 Likes

This is such a common problem it’s unfunny.

4 Likes

Well, hello guys… I’ve got something to say that is kinda bothering me… I shared with my colleagues at college but they don’t seem to care very much.

I made a program to calculate the prime numbers with a function inside a for loop from 2 to 100.000, in both C and Java, compiled them each one at a time and ran each one at a time…(they’re not the most optimal ones, they just work)

And to my surprise both finished in similar times… which was around 43 seconds, could be more or less, I was counting in my mind, so yeah… (it was on my ancient i5 2450m on battery)

You guys wanna check out the code and run it yourselves to try to solve this mistery? Is there a bamboozle in this which I’m not seeing?

basically math is about the same in any language, regardless.

The issues arise during runtime. C/C++ is better at runtime because its lean on resources because it forces you to do so; while java drags it feet for the garbage collector to do it.

But yeah if you wanna share then by all means.

1 Like

That’s not the problem, really. It will perform the same under these conditions. It’s when applications get bigger, and are built on frameworks when issues arise. And they’re still not that kind of simple math operations usually, you’d still benchmark that and get a similar result.

Truth be told, this not just a Java problem, but Java is exceptionally good at being bad at it. When bigger applications are glued together like that, it usually hits every possible cache-miss, middleware, pointless allocation of memory (resulting in amazing GC times) and who knows what else resulting in bad performance. You can screw up C++ that bad too, but it would actually take effort or long periods of negligence to actually get that bad, because you’re managing it manually.

Another clue is that Java prime number generator probably took around 300MB of RAM.

2 Likes

Like dynamic_gravity mentioned, for basic things it’s about same for most languages.

Create a 1.000.000 row multilevel dictionary with 64 character string keys, and sort it.

1 Like

JS, Node.js and other frameworks, like React, Vue and Angular (and tons more) are worse than Java itself. I’m running NoScript and uMatrix in my browser all the time and I wouldn’t have it any other way. In fact, I wish Level1 Forums wasn’t using JS (not even sure what framework / template it is using right, I think it is Discourse).

1 Like

I’ll probably try it soon enough. Strings made of alphabetical characters or numbers?

If numbers: parsed into Integers from 1 to 9? Hex?

If letters: sorted by order in appearance o nthe alphabet?

I kinda despise interpreted languages (yes python I’m also looking at you).

I think it’s not really safe to have things checked upon runtime, sounds kinda dangerous to me, maybe cause I’m a n00b

All languages has a use where it’s just a bit better than another one. Java is good for teaching OOP, and generally get into object oriented programming. Annoying thing is that after finishing studies, many stay with the language they learned, and sub optimal languages are used to solve a given problem.

To make the strings, I’d loop the code below. Python ftw :stuck_out_tongue:

Import string, random
''.join(random.choice(string.ascii_letters) for i in range(64))
1 Like

that’s such little code to do so much haha

I guess that’s the appeal of python. Here in Brazil the industry hasn’t embraced python yet, you can see a lot more of java, javascript and c# jobs

I’m not sure if java has a function such as this, never heard of any, but also I have heard just a little about a few things :stuck_out_tongue:

This is how I’d do it in javascript.

Just change the length in the for loop but for some reason its chokes after 100,000.

(() => {
  function randomString(len) {
    const p = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
    return [...Array(len)].reduce(a=>a+p[~~(Math.random()*p.length)],'');
  }
  let arr = [];
  for (let i = 0; i < 10000; i++) {
    arr.push(randomString(64));
  }
  console.log(arr);
})();

I’m trying to figure out how to concatenate and put them in alphabetical order, but only generating one random char I already have more lines than @Dynamic_Gravity hahahahaha

Java (2000, Colorized)

whoops didn’t mean to reply to @Dynamic_Gravity
anyway
pretend this isn’t here, it ruins the joke

1 Like

I kind of shared your opinion on python earlier. Worked a lot in visual c++, c# and VB up until a month after windows 10 was released. Then windows got thrown out, and I switched to only Linux. I haven’t regretted it for a split second since.

Started with python, had issues in the beginning because it’s quite different, but now, I love it. It’s plenty fast for anything you need really, if you want it to run even better, then you can freely use c++ to create very efficient applications. Only thing I’m a bit dissatisfied with, is multithreading, but it gets the job done.

2 Likes