49 ms·
Don’t call it a comeback: Java is still champ
- rr808 4y agoI've ditched Spring, am using Vert.x with Java 17, reactive & functional styles, records. Seems like a completely different language. If only project Loom will get out there so I wont be coding everything like Javascript I'd be happy. :)
- jayd16 4y agoHmm Javascript has async though, no?
- 5e92cb50239222b 4y agoThat's exactly what was meant. With Loom Java will hopefully not have the same function split as languages like JavaScript (or C# for that matter) where you have to add lots of async/await everywhere; and instead will have something like Go (where everything is async). https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/ https://journal.stuffwithstuff.com/2015/02/01/what-color-is-...
- vbezhenar 4y agoAsync stuff in JavaScript light years ahead of Java's Future madness. Loom might help but I'm not optimistic about it. For example Spring already kind of deprecated blocking http web client and new reactive WebClient is terrible. Will they create yet another BlockingWebClient? No they'll ask you to call `block` everywhere and write reactive nonsense filters if you need to enhance it. Spring is worst thing happened with Java.
- dymk 4y agoThat may be true, but JavaScript forces you to bisect your libraries (and functions) into Those that Understand Async and Those That Don't [0]. There appears to be no path forward if you want to avoid that. It's very difficult to write generic, reusable higher-order code that shouldn't care if it's doing a sync or async operation. Java at least is building a foundation in the right direction. [0] - https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/ https://journal.stuffwithstuff.com/2015/02/01/what-color-is-...
- vbezhenar 4y agoIf you mean that you can't write `map` which would work for sync and async functions with the same code, that's extremely rare problem IMO. If you really need that and don't want to write two versions of code, you can wrap blocking code with promises and use promise API from now on.
- dymk 4y agoIt's not at all a rare problem if you work in codebases involving async code. Many `Promise` APIs exist solely to work around that wart. Higher-order functions are the bread and butter of JS, and increasingly Java (especially modern Java).
- kaba0 4y agoBut async stuff is a must in JS due to it being single-threaded (yeah I do know about webworkers). Just spawning a thread with a scope which will fork them at the end is just better from every conceivable way. Easier to grasp, easier to maintain, easier to debug - all of which are quite important when concurrency is at the table.
- deleted 4y ago[deleted]
- pca006132 4y agoI don't understand the part about go, does that mean go doesn't require async but gives you the functionality of async? (I never tried go) The problem with async is that we can separate when to start a task and when to ask for its result. The compiler can just add await everywhere an async function is called, it is trivial, but you don't get the flexibility of async. If everything is treated as async, you will need to await everything (perhaps some syntactic sugar to allow for immediate await)
- shellac 4y ago> If everything is treated as async, you will need to await everything In go you work rather differently. You let tasks go off and do their thing, and provide a channel to communicate. Pulling a response from the channel is the 'await'. A good part of go's magic is that these tasks - goroutines - don't result in large amount of blocked threads. Java will soon have the building blocks of something rather similar to goroutines.
- pca006132 4y agoOK I see, but I think these two approaches address different problems? The approach used by go is more powerful than async but also more verbose. The implementation is also different, async can be implemented with a generator but goroutine can't.
- jayd16 4y agoI guess I was confused because right now you do not code Java like that.
- deleted 4y ago[deleted]
- sabareesh 4y agoWeird Spring is the reason why i am sticking to Java
- commandlinefan 4y agoSpring would be my only reason to ditch Java.
- treis 4y agoI just can't get past annotations as a thing. Seems like a crime against programming to me.
- sabareesh 4y agoWell it is just another design pattern, i love annotations but it might be better even without it, Spring boot takes care of most of the things and it only needs very minimal annotation which makes sense.
- kaba0 4y agoI don’t know, I think it’s closer to some LISP magic macro than Lispers would like to admit. They are extremely powerful, and thus can be responsible for some very ugly code, but when used responsible, they are huge productivity wins.
- wildrhythms 4y agoAgreed. I hate digging through a mountain of annotations to try and decipher what additional side effects some method might have (additional to any existing side effects). I have never seen a codebase where annotations were some necessary compromise; I feel like whatever crucial parameters is being passed through an annotation could have just as easily been put into the arguments and made a part of the method signature like they're supposed to be. Annotations were a mistake.
- exabrial 4y agoTry CDI! much cleaner, faster, and without the Factory Factory Factories.
- vips7L 4y agoI’d rather write Spring than Vertx callback or observable hell.
- decebalus1 4y agoThe time I used vert.x in my day job was by far the best Java experience in my career. Completely different language. And the vert.x maintainers have been all around great wrt to responding to issues and/or accepting contributions. Great framework. It has it's quirks and limitations but overall I absolutely loved working with it.
- llllllllllll9 4y ago
- abledon 4y agoFor anyone else who can't get the LLCoolJ popup player to work while reading the article: https://www.youtube.com/watch?v=vimZj8HW0Kg https://www.youtube.com/watch?v=vimZj8HW0Kg
- falcolas 4y agoJava's adequate. It's like a Toyota Corolla (insert your boring car of choice here if you don't feel this one works for the analogy). Not the prettiest, not the fastest, not the most efficient. But it gets you from point A to point B with little fuss or muss. I totally get why companies adopt and standardize on it. Do I use it for personal projects? Nope. Because it's not fun to "drive". For that, I pick the equivalent of a Mazda Miata (insert exciting car of choice), which for me is usually a Lisp.
- NoSorryCannot 4y agoWhoever invented the car analogy should pay for what they did.
- deleted 4y ago[deleted]
- jgust 4y agoBagging on car analogies is like driving a Hellcat, it's not practical.
- deleted 4y ago[deleted]
- bil7 4y agodo you have some other anology we should all switch to? maybe a ferrari level analogy that's way better?
- mindslight 4y agoIndeed. All cars suffer the same speed limits and traffic, so how effective your car is ultimately depends on how you drive within those constraints. The analogy slyly condenses everything down to some car-manufacturer-marketing version of "fun", betraying both spirited drivers and whatever topic it is applied to. Since we're throwing out analogies, Java-the-language is more like a riding lawnmower. It is capable of getting you to your destination, but will be slow and painful the entire time. There is probably some external constraint that you'll be forced to endure this, like losing your license.
- thex10 4y agoBeing taught intro Java in high school (mid 2000s for me) was excruciatingly boring and caused me to write off majoring in computer science or working as a programmer. Today I'm a software engineer with experience in JavaScript, Ruby, Python, Elixir... maybe it's time for me to give Java another try.
- ramesh31 4y ago>Today I'm a software engineer with experience in JavaScript, Ruby, Python, Elixir... maybe it's time for me to give Java another try. Nah. If you have to use it, Java's really not that bad. But I would never choose it for a personal project. Its' strengths are in all of the concerns that come with enterprise development.
- rco8786 4y agoIt's not. Java has slightly improved since that time, for sure, but you're not missing anything.
- al_mandi 4y agoSignificant performance improvements, several new GCs, stream API, type inference, records, pattern matching, switch expressions, lambdas, default interface methods, 6 month release cadence, try-with-resources, GraalVM, many new APIs (like `java.time`), JFR open sourced, virtual threads (in preview), value types (in the works), improved native interop/FFI (in the works), etc. are more than just a "slight improvement".
- afandian 4y agoTry Kotlin. I love it. Feels like the best bits of Clojure, Ruby, Python and Java.
- seanmcdirmid 4y agoKotlin is great! I cringe when I have to go back to Java occasionally for some reason.
- 4y ago
- deleted 4y ago[deleted]
- pdntspa 4y agoI recently started a side new project in Java targetting GraalVM with language version 17. Aside from Java's innate finickyness, it has been an unexpected pleasure. I think a lot of it has to do with its static typing (I typically work in dynamic languages, and it's nice knowing that if the program compiles it likely works), and how simple the language keeps its primitives. But you need really good tooling to use it, like a powerful IDE with good autocompletion and refactor support. It is way too verbose to type everything out yourself, and the verbosity means manually refactoring takes lots of changes around the program to manifest. The sheer amount of code out there to import is immense, there seem to be libraries for anything and everything! So far, it seems like the time I lose to its pickiness, I gain back with IDE features, static typing, and the ease of understanding it (because it is so verbose). I'm also not hot on how it seems to steer everything into a factory pattern, but so far I've been able to avoid that for most things.
- binkHN 4y agoHave you explored Kotlin? It's really not just for Android.
- nerdponx 4y agoI've heard from a few corners that Kotlin is "Java but better", but I've also heard that the tooling is pretty lacking if you aren't using JetBrains stuff. True?
- dboreham 4y agoSuccessfully used VSCode for Kotlin projects.
- deleted 4y ago[deleted]
- pdntspa 4y agoI have, it's a nice language but I didn't like the mental tax of translating Java code to Kotlin in my head whenever I had to read up on how to do something I do intend to dig into it a bit more once I feel like I have mastered Java
- abadger9 4y agoI've used Java my entire career and i'm fortunate for it. I appreciate how readable the code is (unlike my experience with Erlang, Haskell, etc), typically i don't have foundational issues in the web framework (once again had some with Haskell). Everything works, if I need to do low latency, there's great libraries and resources, if i need to build a simple internal tool, it can be done effortlessly. I think python is the same way, the ecosystem is so rich that you can really do anything you want (until you get into low latency).
- thrown_22 4y ago>if I need to do low latency If the JVM is considered low latency I shudder to think what is high latency.
- 5e92cb50239222b 4y agoJava is heavily used in high-frequency trading. I believe it's the most popular language after C++.
- zinxq 4y agoIndeed. Shutoff Garbage collection completely and it can work. (And make sure your Java code creates no garbage - which is a new type of programming in and of itself)
- vips7L 4y agoMaybe I’m taking your comment wrong, why is this a bad thing? What other GC’d language just lets you turn it off?
- bee_rider 4y agoI don't think their comment is intended to be negative really -- looks more like appreciative of the option, while cognizant of the fact that using it introduces a new challenge.
- johnklos 4y ago...and it's still a security nightmare... I think some developers took "write once, run anywhere" as a challenge, which is why I still have to keep virtual machines with ancient Java versions around to configure and use certain remote IP-based KVMs, certain IPMI functions, certain older fibre channel switches, certain poorly thought out IP cameras, and so on.
- nix23 4y agoJust wait until GO has so many years on the back, java is not a "security nightmare" developers/businesses with zero responsibility are.
- charcircuit 4y agoJava has been very good at backwards compatibility for me except when they removed some unsupported internal classes from the 1.9 JDK, but there existed a workaround for still using it. I don't worry about security problems in the JDK or major libraries any more than anything else. I'm not sure where your security concerns are coming from.
- vips7L 4y agoWhy is that Java’s fault? Isn’t that the fault of the developers of your applications from not upgrading?
- e67f70028a46fba 4y agoThe biggest thing Java is missing is full hot swap. Its been implemented via the dcevm but, inexplicably, has been ignored by both sun and oracle. This one, existing technology would make Java DX on par with the dynamic languages
- deleted 4y ago[deleted]
- topspin 4y ago> The biggest thing Java is missing is full hot swap The biggest thing missing in Java is an answer for the billion-dollar mistake. Real world Java is plagued by NPEs because a lot of Java is written by low caliber programmers. Java + functional error handling would be a monumental improvement.
- jayd16 4y agoYou could always try C#. They have a non-null compile mode where variables are non-nullable by default. They did the work to mark up core libraries and also have some pragmatic handling of olde nullable calls in 3rd party libraries.
- commandlinefan 4y ago> low caliber programmers Can't really blame Java for that, though - if everybody standardized on, say, Haskell (or whatever we might agree is the "gold standard" for programming), the low caliber programmers would find a way to do something stupid in it, too. The only way to get around low caliber programmers is to raise the standard, but any suggestion of raising (or even setting) a standard for programming invites accusations of "gatekeeping" (a gate that really, really, really ought to be kept).
- topspin 4y ago> Can't really blame Java for that, though Hmm. Can't I? I know why Sun made Java. They wanted a platform to develop applications that didn't require the skill of a competent C++ programmer. They were targeting lower caliber coders. I'm a pragmatist; yes, Java programmers would still find escapes, but they'd do it less and so the net number of flaws would be smaller. As jayd16 points out, there is a pragmatic way to deal with this; provide a compiler mode that eliminates null dereferences and rework the standard library to accommodate this. Simple and obvious. Afterwards you can throw the switch on whatever code your facing and you'll know if you're dealing with crap or not.
- bullen 4y agoThe only problem Java has is experienced C programmers don't build servers from scratch with it yet. Once they take that responsibility, the debate will be over because: "While I'm on the topic of concurrency I should mention my far too brief chat with Doug Lea. He commented that multi-threaded Java these days far outperforms C, due to the memory management and a garbage collector. If I recall correctly he said "only 12 times faster than C means you haven't started optimizing"." - Martin Fowler https://martinfowler.com/bliki/OOPSLA2005.html https://martinfowler.com/bliki/OOPSLA2005.html "Many lock-free structures offer atomic-free read paths, notably concurrent containers in garbage collected languages, such as ConcurrentHashMap in Java. Languages without garbage collection have fewer straightforward options, mostly because safe memory reclamation is a hard problem..." - Travis Downs https://travisdowns.github.io/blog/2020/07/06/concurrency-costs.html https://travisdowns.github.io/blog/2020/07/06/concurrency-co... "Inspired by the apparent success of Java's new memory model, many of the same people set out to define a similar memory model for C++, eventually adopted in C++11." - https://research.swtch.com/plmm https://research.swtch.com/plmm This combined with the fact that Java doesn't crash and you can easily hot-deploy the classloader (maybe 100 lines) means nothing can compete that doesn't copy everything Java does VM + GC (hello C#, please don't downvote). To use anything else (than JavaSE without heavy deps.) on the server is madness.
- nelsondev 4y agoThe p50 speed up from delaying memory management comes with a trade off, namely you get Garbage Collection pauses, bad p99, and spend your effort tuning the Garbage Collector instead of your code.
- oaiey 4y agoFunny how the revival of Java is similar to the revival of .NET. After some stale years, both languages refined themselves and are back in the top competition (.NET in the VM space, Java in the language space). It really shows which languages can re-invent themselves (Java, .NET, PHP, ..) while some fail (Fortran, Basic, Pascal, Perl, ..). Not sure where JS is ;). Python seems to have survived the 2/3 schism by now.
- diarrhea 4y agoI guess both JavaScript and Python reinvented themselves through gradual typing. It makes Python quite a different language and JavaScript literally a different language. My most recent small (1k LoC) Python project is “fully typed” and therefore practically type safe (not strictly speaking though). Lots of the large libraries are typed as well, which is important. For Python, work around the GIL might be the next evolutionary step, that time in the name of performance.
- oaiey 4y agoI agree. It seems like the road for dynamic languages goes through optional typing. And it is logical because their weak spot right now are huge systems. I have to add that JavaScript would greatly benefit from a solid base class library
- naikrovek 4y agoand it still enforces terribly strict OOP patterns onto the developer which is almost never the right way to develop software if you care about performance even a little.
- nailer 4y agoEven if you don't care about performance and only care about simplicity OOP is really hard to rationalise about.
- commandlinefan 4y agoJava has supported (mostly) functional programming constructs since 1.8 (which was 2014), so you can realistically use it without doing too much OO. I've observed, though, that people who complain about OO in Java usually write top-down procedural code rather than functional-style code, which is far, far worse.
- nailer 4y agoI’ve observed that Java has a culture of OO, so people tend to be unaware of scopes, closures etc.
- jayd16 4y agoWhat can't you do in Java that you want to do besides the fact that there's no stack allocated type (which is a java thing but not an oop thing)?
- kaba0 4y ago(Nitpick, but primitives are stack-allocated)
- bhuber 4y agoI'm not sure you fully appreciate how tailored the JVM, and hotspot in particular, are to executing OOP oriented code. One great example I can think of is polymorphic methods. In C++ for example, you have to explicitly declare a class method as "virtual" in order for it to be polymorphic - i.e. the version called at runtime is tied to the runtime object instance, not the compile time type. This is because in order to do this in C++, there needs to be an extra lookup in the vtable to find the function address for every virtual function call at runtime. If C++ made all its methods virtual, it would take a significant performance hit from the extra vtable lookup for every function invocation. In Java, all methods are virtual by default. Java also does the equivalent of a vtable lookup at runtime for function calls, but it has something C++ doesn't have - the hotspot optimizer. For any call site that is executed enough to affect runtime performance, the hotspot optimizer will optimize away the vtable lookup if there are only 1 or 2 method versions called at that site at runtime. This is true for the vast majority of cases. For most of the other cases, where you have 3 or more possible method implementations that could be invoked at a given call site, you would probably have to have something like a vtable lookup at that call site whether you use OOP or not (switch statement, if-else, explicit table of function pointers, etc), so you're not losing performance there either. The end result is, the JVM gets polymorphic methods basically for free in terms of performance. This is just one example, there are many other clever things the JVM does to make OOP code performant. I don't have a citation, but I do recall seeing a talk (maybe by James Gosling?) where he mentioned that one of the primary design goals of Java was to make "doing the right thing" from an OOP perspective also the best option for performance.
- pid_0 4y ago
- mkl95 4y agoI wrote a lot of small Java programs when I was in school, and Eclipse felt like being on developer steroids compared to using an IDE with a dynamic language. My software just worked and was pretty fast. I have mostly worked with Python since I became a pro developer and I often wish it was a more "boring" language.
- fareesh 4y agoI don't really write in Java these days, but when I did the biggest pain points for me were: - IDE: IntelliJ and before that, Eclipse, were painfully slow to use. Even now occasionally if I have to launch Android Studio I have to wait for Gradle and various other things. The entire IDE gets sluggish while it's doing indexing and all sorts of weirdness. vim integration was quite poor at the time, I don't know if things have changed since. - Verbosity: It always feels like I am writing boilerplate and long names. I remember trying to write something with websockets and no matter what library I picked there was a ton of boilerplate to write for just connecting to a socket and sending a message. If given a choice I'd much rather write in Python, C#, Ruby or even Typescript. The language feels very dated - or perhaps there are newer ways to do things that I'm totally unaware of.
- fenesiistvan 4y agoIDE: Borland JBuilder was a king. I am still using it Websockets: you can write your own in around 400 lines of code. I did it. The specification/RFC is really simple. Just a few bits above TCP
- dopamean 4y agoI spent almost all of my career writing Ruby before I ended up at a company that required me to write mostly Kotlin (a bit of scala here and there too). After a few years of Kotlin I don't want to use anything else. There's a bit more ceremony to getting things set up but the experience of writing Kotlin with Intellij IDEA has been so wonderful I'm happy to keep doing it.
- jrsj 4y agoAfter mostly using Node and Go for the last 3 years I kind of miss Java honestly. Unfortunately it's still terminally uncool in my local job market so even mentioning it would be a bad career move.
- mdasen 4y agoThe JVM is pretty great. I could certainly nitpick things, but it's pretty great. Java is pretty decent. However, I would say that Java lost a lot of time and even now there are some decently rough edges. Java didn't evolve as a language for a while and that left the door open to other languages and other non-JVM ecosystems a lot. As the article notes, Java 8 was a breath of fresh air, but it was minimal in some ways. Lambdas and streams were great additions to the language. However, Java 8 came out in 2014. That's quite late to the game, in my opinion. C# is probably the closest competing language/ecosystem (albeit constrained to Microsoft for much of its life). In 2007 (7 years earlier) C# 3.0 had lambdas, the `var` keyword, properties, object initializers, the equivalent of streams (and really better), nullable types for value types (like int), etc. In some ways, Java has caught up - and C# lost a lot of time being constrained to the Microsoft ecosystem. However, in other ways it hasn't. I just want a POJO: frankly, this has been a problem that Java hasn't solved and it's been well over a decade where everyone has known it's a problem. No, records don't solve it. In Kotlin, I can make a data class and it's easy. In Scala, I think they're case classes. In C# I have properties where I can say: `class Person { string Name { get; set; } }`. I can see that it's just a boring property without having to look at method bodies. If there's something special, that get or set can have a body to do stuff and it becomes really clear that it's something special. Getters and setters are a wonderful way to set traps for others on your team or for yourself a year later because you look at a class with 15 items and it's going to have 90 lines of getters/setters + another 30 lines of an empty line between each method. You look and just decide "yea, I'm sure this doesn't have special behavior" and go about your business just to get bitten later. I want to be able to instantiate data easily: With Java, I can do `var person = new Person(); person.setName("Johnny");`, but that becomes pretty tedious and error-prone when instantiating a large object. With records you have a constructor, but then you're dealing with positional arguments and it's hard to understand. When reading the code, you don't necessarily know what each of the inputs means. Maybe your IDE puts the argument names in. When filling it out, I've found IDEs to only be somewhat helpful. With C#, I can do `new Person { }` and then hit the suggestion key combo inside the brackets in my IDE and it'll offer to fill out all the properties so that I get something like: new Person { Name = "", Age = 0, Address = "" } That means I don't forget about fields (as can happen if you're just doing `person.setX()` all the time). It's easy to see what is what when reading it. I can delete fields I don't want to initialize at the time. Yes, maybe immutable objects are the One True Way, but C# lets me choose (I can label properties with an initializer `init` rather than a setter `set` and then they're immutable). Kotlin offers stuff like this too because it's really useful toward creating code that's easy to create and maintain. Go also lets you initialize structs in a similar fashion. Java has come back to us a decade or more late with records. They're not bad, but they're only offering one thing. They don't cover what C#, Kotlin, Go, and other languages have offered for so long. The annoying thing about Java is that it doesn't feel pragmatic a lot of the time. It feels like the language hates stealing ideas from others. It's Java: people steal ideas from Java, not the other way around. People do crazy things just to get POJOs including Immutables (http://immutables.github.io http://immutables.github.io), AutoValue (https://github.com/google/auto/ https://github.com/google/auto/), Lombok (https://projectlombok.org https://projectlombok.org), Joda Beans (https://www.joda.org/joda-beans/ https://www.joda.org/joda-beans/), and maybe more. They generate lots of code at compile time or do funky runtime stuff. It just feels like Java misses the pragmatic stuff and still kinda doesn't want to handle that. I feel a bit silly harping on things like POJOs and setting data on a new object, but that's a big part of day-to-day stuff and it definitely pushes users away from Java towards languages that seem "better" simply because they don't have Java's oddly strong attachment to not offering simple value objects. Yes, again, records do something - but it feels like Java ignored how people are using Kotlin, Go, C#, and more and didn't go for something that would have been as widely applicable and pragmatic as it could have been. Java has a lot of great stuff like great GCs (yes), lots of cool research, great performance, and Project Loom is really exciting. I just wish the language would lean a little more practical.
- hackerlight 4y agoJava is the perfect choice if you need something that runs really fast but not really really fast. It fills that niche very well.
- jmartrican 4y agoI was doing live coding in an interview yesterday and the interviewer said "you have a problem in your code, you put var, and this is Java". I had to explain that the language has modernized quite a bit.
- mihaigalos 4y agoAnybody have experience with the JNI interop with native libs? Is it better to implement something natively in a compiled library and link it in from Java or better to rewrite it in Java? What about lifetimes of objects - who "owns" an object - the runtime or the lib?
- kaba0 4y agoUnless absolutely necessary, I would say avoid using it - the JVM ecosystem is almost completely pure in terms of being written almost entirely in itself. If it is a must, then I recommend looking into the new Panama APIs that help a lot with scope, can autogenerate code from C headers, etc.
- Cwizard 4y agoI think Java gets a lot of flak because it is so popular within enterprises. And we all know what kind of code gets written in non-IT corporates. Add to that the fact that Java allows you to do a lot means a lot of crazy code was conjured up over the years which then had to be maintained and developed. If you apply some discipline, I think Java is a great language.
- teknopaul 4y agoTrouble with java is that it does not scale up or down in terms of ram. Minimum RAM for a sever doing something normal over tcp is measured in gigabytes. Big servers > 16gb get difficult to manage at runtime. You have to scale with more VMs. You can write useful C servers that are very small, especially if you compile with musl. And run the same code for 1000kcc (not a typo) When you have big arrays of memory storing everything as Objects/pointers gets messy and inefficient. But any big heap is hard to manage and keep response times consistently low. My other gripe os that "write once run anyway" is no longer close to true, since Oracle. Mac, Linux x64 and Windows 64 are your only sane options. If you look at the compile targets list for c or rust you can see write once run anywhere working on a lot more cpus. True, you might have Arch specific code but it works, and most Java does not port from Linux container to Windows for example. A statically compiled Binary is often easier to move across systems, because a java app is rarely a single jar. It's usually >5gb of app specific jvm and libs and config files.
- Dracophoenix 4y agokcc in this context is "kilo clock cycles", right?
- ElectricalUnion 4y ago> Trouble with java is that it does not scale up or down in terms of ram. > When you have big arrays of memory storing everything as Objects/pointers gets messy and inefficient. But any big heap is hard to manage and keep response times consistently low. Java can handle very large, TB-sized heaps (under normal circunstances, about 52TB). But when you're dealing with TB-sized heaps, anything is slow - including programs not made in Java. > You can write useful C servers that are very small, especially if you compile with musl. And run the same code for 1000kcc (not a typo) Anyone can build stuff with musl, but musl is in general a lot less optimized that GNU glib, so I guess it really only makes sense on resource-constrained environments - not those where you're handling TBs of heap. > A statically compiled Binary is often easier to move across systems I guess you're talking about jart/cosmopolitan here, not your average musl application - a statically compiled Binary usually needs to be recompiled to work on other systems. > because a java app is rarely a single jar. Uberjars are very common, the norm those days. > It's usually >5gb of app specific jvm and libs and config files. On my experience even if you "accidentally" bundled the whole Java SDK together with your app, you're not getting over 250MB for Java. Unless you're counting the whole OS, in that case, even the musl application isn't that small anyways.
- master_jonsie 4y agoWhat does the Jet Propulsion Laboratory have to do with Java?
- bilsbie 4y agoI’ve never once enjoyed writing Java. To me that’s worth a lot. To me it’s always felt like some kind of assembly language humans shouldn’t deal with directly.
- ralmidani 4y agoJava was actually not bad for me in class when learning software design and data structures, but soul-crushing to work with in the real world. Mindless, unnecessary use of getters/setters, interfaces, and AbstractFactoryImpls. Hiding almost every piece of functionality behind 10+ layers of indirection. Dependency Injection with Spring. They all make it feel like Java draws folks who actually __enjoy__ writing bloated, over-engineered garbage. YMMV, of course, and yes, there are modern frameworks other than Spring (Play is supposedly pleasant to work with), but life is too short to try to sort out that mess. I plan to stick to Elixir as much as I can, for as long as I can. When the language clicked for me, it was the biggest breath of fresh air since I decided to pursue programming as a profession, and even cooler than when I discovered Python/Django. Edit: obviously, Java is not all bad, and not all (or even most) people who use it fit the description above. But something about the ecosystem seems to draw those types (no pun intended) disproportionately.
- i386 4y agoAll my new Java projects don’t use spring for that very reason. Nothing wrong with the new keyword.
- geodel 4y agoExcellent!. Its good to hear about places where Spring nincompoops do not shove their crap framework down everyone's throat.
- pwinnski 4y agoI don't think this is an issue with Java, it's an issue with Spring. I'm baffled by the popularity of Spring.
- ralmidani 4y agoI’ve seen similar patterns with tech that’s older than Spring (Servlets/JSP). Also, wasn’t it EJB that promoted getters and setters everywhere?
- otabdeveloper4 4y agoW-w-wait, I thought all software as unequivocally being written in Rust now?
- therealmarv 4y agoI'm extremely happy I have not had to use it beside one liners for the last 12 years of my professional freelancer career. I still remember the times when Java people were laughing at me when I was telling them that I'm mostly a python developer.
- exabrial 4y agoThe CDI specification is what takes Java from "good" to "incredible". The dependency injection pattern makes Java a hybrid functional language, where all the state can be stored in the CDI container. This eliminates a whole class of bugs and simplifies a codebase allowing for pervasive use of composition. Stuff like Microprofile, Quarkus, ActiveMq, Tomcat, and even JakartaEE are gravy on the cake.
- mark_l_watson 4y agoSun Microsystems had a link to my blog on the Java home page for about a year. I had attended the first Java World Tour, blogged about it, and for 15 years I was the first “hit” searching for “Java consultant”. Thank you Java. All that said, I don’t use Java much anymore, preferring to use Clojure when I need the rich JVM ecosystem. I do follow new Java language features and usually try them.
- vasili111 4y agoWhat you think about Scala? How you tried it?
- mark_l_watson 4y agoI used Scala many years ago, mainly because I took the language designer’s Functional Programming with Scala class.
- vasili111 4y agoWhat is your opinion about Scala? I have not tried it so was interesting what thinks about Scala person that was using Java, Scala and Clojure.
- mark_l_watson 4y agoI blogged a comparison 10 years ago: https://mark-watson.blogspot.com/2012/10/clojure-vs-scala-smackdown.html https://mark-watson.blogspot.com/2012/10/clojure-vs-scala-sm...
- danieltanfh95 4y agoit's ironic that with all the hate on outsourcing that there's love for java. The real reason why Java is a champ is because outsourced labour uses them. https://blog.jetbrains.com/idea/2020/09/a-picture-of-java-in-2020/ https://blog.jetbrains.com/idea/2020/09/a-picture-of-java-in...
- cutler 4y agoHere's a typical example of the pain of Java language evolution. As an ex-Perl developer and frequent user of Ruby and Python I am accustomed to being able to write a regex without having to escape metacharacters such as \d (digit) and \w (word character) as is necessary in Java where regular expressions are merely strings fed into the Pattern.compile() method. So imagine my elation when I discovered that raw string literals were being previewed in Java 13. Then imagine my horror when I discovered that regex metacharacters somehow missed the party and STILL had to be escaped inside raw string literals. WTF!?
- didip 4y agoAll this talk about Java frameworks and no one mentioned javalin.io? It’s one of a few frameworks that makes writing Java less tedious again.
- neonsunset 4y agoWith Unity, Avalonia/Uno Platform, ASP.NET Core, NativeAOT and compact self-contained trimmed JIT deployments, the sheer cross-platform, cross-workload and deployment flexibility proposition of C# far surpasses Java even if we count in JVM + Kotlin for additional points of the latter. Now let's talk performance of most commonly used web frameworks. I will save you the trouble of reading long text. Just check https://www.techempower.com/benchmarks/#section=data-r21&test=composite https://www.techempower.com/benchmarks/#section=data-r21&tes... and search the tabs for the more popular Java frameworks like Spring, Spark, Struts, Grails, Wicket, etc. You may find yourself surprised, finding most of them in the bottom 25th percentile. Now scroll back to the top of the page and check where ASP.NET Core is. That's right, more often than not, in the top 10. All that performance, and you get it out of box just by using defaults and then some more. The only exception I see is Vert.X which is both mentioned across the web and also present in the top of the list. Now, you may say that it's not very representative and there are entries of dubious usefulness in production scenarios (looking at you Just.js). And you would be right. However, the way to get most performance from ASP.NET Core is not by using tricks but rather simply writing code like in Node.js with app.MapGet("/users", delegate) and friends. Despite all this, I still think JVM technologies like Hotspot or GraalVM have an upper hand over what .NET JIT/NAOT is capable of. However, keep in mind the out-of-ordinary performance gains that C# gets with each subsequent release. In areas with significant possibility of improvement like arm64 codegen quality, moving from .NET 6 to upcoming .NET 7 will yield you up to 40% performance improvement from JIT alone. And it was done in significant part by changing the code of JIT/Runtime that used to be x86_64-first to being cross-platform oriented (e.g. Vector codepaths becoming plat-agnostic, correct atomics being emitted for ARM, etc.). .NET Framework used to be stagnant. After becoming OSS, .NET is the polar opposite, getting significant improvements in all of its areas with each release be it runtime code, standard library, language features or supported usage scenarios. I think today, C# and .NET are mostly being held back by decades of legacy libraries and decisions, which you may consider avoiding in favor of newer solutions, regardless if those are in BCL or community-driven libraries. Still, sometimes people simply use code in such a way that unreasonably kills its performance. But as long as you avoid known gotchas, your C# code will easily perform in production at the speed of Rust, C++ or C.
- albertopv 4y agoJVM is a masterpiece. Java improved, but legacy is there. I now prefer and use whenever possible Kotlin, I can do more writing less code and still retaining JVM performance.