6 ms·
I would not call Java streamlined by any measure, API size, library size, or LOCs. If you want to see a streamlined API, see Typescript + Webpack which will tru
by SillyUsername 4y ago
I would not call Java streamlined by any measure, API size, library size, or LOCs.
If you want to see a streamlined API, see Typescript + Webpack which will trump in all of those metrics.
Source: Me, Java coding professionally since Java 1.0 when it was "streamlined" in 1997, and Typescript for the last 5 years.
- vips7L 4y agoThat doesn’t seem like much of a source. Do you have specific examples?
- fidgewidge 4y agoTry compiling a program that prints Hello World to the console and see how many bytes it takes in both source and shipped form. JS/TS will indeed win every time in those metrics.
- vips7L 4y agoWhy is that a metric that matters?
- fidgewidge 4y agoDownload latency is important in many contexts.
- vips7L 4y agoBut isn’t important in the hello world context and in other contexts I don’t think it’s a great comparison. Typical node apps will ship with megabytes of extra files for functionality that would be present in the Java standard library. Even if I take your claim as fact, programming languages are about trade offs. While Java might suffer from download latency it will more than likely beat TS on execution time and gc latencies.
- fidgewidge 4y agoBut recall that Java was once pushed heavily in the form of applets, where code size and download time are critical. That's why Sun developed pack200.
- vips7L 4y agoThis is 2023 not 1996. Applets have been deprecated for a long time.
- fidgewidge 4y agoYou asked for specific examples of where these metrics matter, the web is clearly a specific example.
- Jtsummers 4y agoIt isn't. It tells you nothing about how the language scales up, only how simple it can get when you want to print a value. https://rosettacode.org/wiki/Hello_world/Text https://rosettacode.org/wiki/Hello_world/Text You can see that some languages are simpler than others (even JS can be beat by this useless metric, check out APL). But it gives you no idea how the language scales up for complex tasks.
- SillyUsername 4y agoHelloWorld doesn't. These do (make sure to scroll): https://programming-language-benchmarks.vercel.app/java-vs-typescript https://programming-language-benchmarks.vercel.app/java-vs-t...
- mrighele 4y agoAn Hello World in java is a single class file of a few hundred bytes so I am not sure that is the right example. Source code is more verbose, and although I do prefer Typescript I don't find it a tragic issue. In both cases for anything more complex you will end up with a truckload of libraries, so even there there isn't much difference. I think that were Java is not streamlined at all is in memory usage, because you will probably be able to get the same result with a fraction of memory in Javascript (and many other languages). I'm not sure if the problem is more on the JVM (heavyweight objects and no value types?) or the libraries, I suspect both.
- vips7L 4y ago> I'm not sure if the problem is more on the JVM (heavyweight objects and no value types?) Value types are being worked on with project Valhalla, but also the VM doesn’t give memory back to the OS. It holds on to it up until -Xmx, which by default if i recall correctly is 25% of the machine, so it’s hard to really know how much your program is actually using. It’s actually one of my biggest gripes about the JVM.
- nayuki 4y agoThe HotSpot JVM does return memory to the operating system. https://stackoverflow.com/a/30464183/839689 https://stackoverflow.com/a/30464183/839689 , https://www.stefankrause.net/wp/?p=14 https://www.stefankrause.net/wp/?p=14 , https://shipilev.net/jvm/anatomy-quarks/21-heap-uncommit/ https://shipilev.net/jvm/anatomy-quarks/21-heap-uncommit/ , https://openjdk.org/jeps/346 https://openjdk.org/jeps/346 , https://openjdk.org/jeps/351 https://openjdk.org/jeps/351 , https://malloc.se/blog/zgc-jdk15#incremental-uncommit https://malloc.se/blog/zgc-jdk15#incremental-uncommit
- vips7L 4y agoObviously it does. I said that typically it will expand the heap until Xmx is reached, which according to your links is exactly what G1 will do.
- kaba0 4y ago
- peterashford 4y agoIs that really what you feel is a useful metric for a programming language?
- SillyUsername 4y agoI'm sorry if 25 years of experience in Java programming doesn't seem a lot to you. Given it's almost as long as Java has been about, and I've worked at EA and other companies full time as a mobile server side architect, am an open source contributor (albeit not a popular contributor, but one who codes in 4 languages regularly) perhaps you might like to reconsider my experience as sufficient. Java has a lot of required infrastructure, typically Spring these days, which brings with it all the boiler plate. Spring Boot is an "opinionated stack" (Google it) which basically is needed because _there is so much configuration required_ due to its enterprise level design, you can't just strip Spring out and have Java serve a basic 200 RESTful endpoint in the same footprint as other modern languages. Additionally most projects typically include a lot of legacy mis-steps or third party Apache libs that have added bloat (3-4 logging libraries in a single project not uncommon, 2-3 Date apis, numerous XML or JSON parsers etc etc). So while code on the surface seem compact, in actual fact it's built on bloat. And my God the stupid FactoryFactoryFactory antipattern and similar over-engineered crap (I'm ashamed of the neckbeards of my age that actually thought this was a good idea). In contrast TS (or JS), for server side do not require boilerplate, and the syntax lends itself to near native JSON handling removing the need for heavyweight parsing of RESTful or GraphQL endpoint arguments and responses. Then there's Serverless... Java cold starts in themselves are still a joke, Java is clearly better when it comes to batch work and warmed up, but need a quick small AWS Lambda to do something, a true one purpose "microservice" and TS will be both shorter to write and quicker to start, moreover it's half the cost owing to memory and CPU overhead (there are cloud metrics out there to prove this) but Java is more performant and we're talking about streamlining here so I've gone off topic. If you're a Java fanboy, like I once was, you'd do well to spend some time in other languages, not just to play in some small projects, then you'll come back to Java with a different perspective.
- vips7L 4y agoFWIW I wasn’t personally attacking you. I was just trying to make sure you provide evidence of something being bad when you claim it to be bad. That being said I think your experience isn’t representative of the ecosystem today. Spring is not Java. It is not a required dependency. In the last 10 years I haven’t worked on a single Spring application. There are plenty of alternatives with modern apis: Play, Quarkus, Micronaut, Helidon, Javalin etc. > Additionally most projects typically include a lot of legacy mis-steps or third party Apache libs that have added bloat (3-4 logging libraries in a single project not uncommon, 2-3 Date apis, numerous XML or JSON parsers etc etc). Left pad, right pad, isNumber, isArray? I’ll give you serverless, but I’ll repeat what I said in other comments: languages are about trade offs and use cases. They don’t have to be the one language to rule them all.
- deleted 4y ago[deleted]