6 ms·
Off-topic but about Java generally: Java is such a storied and long-running and used-almost-everywhere language especially in Data Engineering (see all the Apa
by gigatexal 4y ago
Off-topic but about Java generally:
Java is such a storied and long-running and used-almost-everywhere language especially in Data Engineering (see all the Apache Data Eng projects like Calcite, Hudi, etc) but I just find it soooooo verbose and everything being a class and having to override things ugh .. it's all the things I hate about OOP in the forefront.
- carimura 4y agoOne of the goals of Project Amber [1][2] is to move the language towards a more data-oriented programming model. With Records, patterns, sealed classes, etc., it should feel much less verbose over time. And unrelated to your concern but addressing some of the learning overhead, see Paving the Onramp. [3] [1] https://openjdk.org/projects/amber/ https://openjdk.org/projects/amber/ [2] https://inside.java/tag/amber https://inside.java/tag/amber [3] https://openjdk.org/projects/amber/design-notes/on-ramp https://openjdk.org/projects/amber/design-notes/on-ramp
- halfmatthalfcat 4y agoSo...Scala?
- carimura 4y agoSure, but you could refer to the lineage of a dozen languages. Most of the world runs Java and evolving it takes care and consideration not to alienate a massive user base and ensuring that it evolves in the right way, not quick responses to fashions and trends.
- eternalban 4y agoIsn't there natural interop between Java and Scala? Why needlessly enlarge the language.
- vips7L 4y agoScala is super complex, introduces breaking changes all the time, is super slow to compile, multi-language projects are also complex, and the decisions that are right for Scala may not be right for Java.
- oweiler 4y agoScala is also on the way out, adoption is steadily decreasing.
- halfmatthalfcat 4y agoI'm not sure I would characterize it as "steadily". I think it's leveled off but I would agree it's not gaining any market share currently.
- hf_twink 4y agoYep, we’re migrating away from it at work too, too many problems, too slow to work with, and too much breaking.
- bcrosby95 4y agoI wish Scala leaned into being a Haskell-like (opinionated statically typed functional language) for the JVM rather than a kitchen sink.
- suresk 4y agoThere was definitely a large and vocal part of the community that wanted that, but I think early on there was a lot of tension between Scala being "better Java" and "Haskell for the JVM", and that probably hindered a lot of adoption.
- gigatexal 4y agoHmm I was thinking of learning Scala. Good to know it’s on the down trend.
- srparish 4y agoAny word on when some of project amber features will come out of preview? I get excited each JVM release for some of those features, but it seems like most of the releases the preview count just gets bumped, and a few more get added to the preview holding pattern.
- pron 4y agoText blocks, var, records, sealed classes, and pattern matching in instanceof have been out of preview for some time, but two more features -- record patterns (https://openjdk.org/jeps/440 https://openjdk.org/jeps/440) and pattern matching in switch (https://openjdk.org/jeps/441 https://openjdk.org/jeps/441) -- are about to come out of preview.
- gigatexal 4y agoVery cool!
- marwis 4y agoIs there any work to make records actually usable out of the box? Things like copying or creating derived records are a huge pain (or slight pain with code generators) while other languages have solved this long ago (even JS and C#).
- kaba0 4y agohttps://github.com/openjdk/amber-docs/blob/master/eg-drafts/reconstruction-records-and-classes.md https://github.com/openjdk/amber-docs/blob/master/eg-drafts/... This is the vague plan.
- dgf49 4y agoSo your (general) complaints are all you do add to this when others try to create things to help others?
- the_gipsy 4y agoJust try something else.
- re-thc 4y agoAnd then you'll hear of it being "verbose" and "boring" too. Grass is always greener...
- ludovicianul 4y agoAs the classic saying says: there are languages everyone complains about and languages that are not (actually) used. Verbosity is usually a _good_ think especially in large code bases with large number of people (where every successful startup will eventually get)
- oweiler 4y agoIf verbosity would be a good thing Java wouldn't introduce language features/ library enhancements to cut down the noise (var, collection factories, switch expressions, records).
- ludovicianul 4y agoThose features are being released to please a larger set of people. People were relying on 3rd party libraries anyway for similar capabilities.
- alfalfasprout 4y agoThe longstanding lack of generics (which has been remedied aside) who really complains about golang? The reality is Java truly shows its age. Its dogmatic insistance on pure OOP and the enormous numbers of horrifyingly unintuitive design patterns adopted by the community cause even the most well intentioned engineering culture to eventually produce ugly codebases. At this point if you're stuck in the JVM ecosystem you're almost certainly better off with Scala (which indeed is actually used) or the newer Kotlin. In a way, for all the shit people give C++ modern C++ codebases are actually quite pleasant and the language is very flexible. Would I encourage its use for general production systems? Not really. That crowns is Golang's.
- seanw444 4y agoAgreed. Reading and writing Java code just really annoys me. It's so ugly, in my opinion.
- dboreham 4y agoJust for balance: after writing much Java years ago, then moving on to mostly JS/TS, Scala and Kotlin, going back and looking at old Java I forget writing, it looks very nice and easy to understand.
- dahfizz 4y ago>> It's so ugly > nice and easy to understand Java is definitely more practical than pretty. This frustrates the trendy crowd, but I think its important for tools to be practical. Shiny, pretty languages are never as long-lived as practical "ugly" languages.
- 5e92cb50239222b 4y agoIf it scares away the "let's rewrite it in language/framework of the day" crowd, that's a plus in my book.
- seanw444 4y agoI'm certainly not a member of the "trendy crowd." I say Java is ugly as a fan of Lisp and C. There's just so much boilerplate to implement something basic.
- therealdrag0 4y agoGoing from Java 8 to Scala was mind melting. Would never want to go back. Though I’ve heard later versions of Java are better. And katlin seems like an in between.
- usrusr 4y agoOr stick to kotlin and keep the mind conveniently solid ;) I was one of the Bored Scala Crowd in the audience of a presentation by jetbrains people that must have been not too long after 1.0, took me half a decade to accept that a "poor man's scala" is actually the language that I want.
- therealdrag0 4y agoYa I’d love to give it a try. Probably will prioritize it for next job Switch.
- lmm 4y agoI found just the opposite. Kotlin would rather add 10 special cases than one higher-order abstraction; I'd rather learn one slightly fancy concept than a laundry list of ad-hoc cases.
- usrusr 4y agoThat's actually a quite accurate description of my own feelings. "Why emulate parts of scala on syntax level when you can have the real thing?". But that "real thing" is the one that drives people to lose themselves in cats vs scalaz debates and the like, there's clearly something in scala that causes a very strong "if you use it to write java without semicolons you're doing it wrong" undercurrent. "java without semicolons" kotlin isn't considered good either, but the distance from there to "kotlin as intended" isn't big at all.
- GregarianChild 4y agoAgreed! Regardless of programming language, every substantial software development needs to make serious architectural choices, otherwise things will become messy. I learned this the hard in my first programming job out of university. We were a C/C++ shop doing distributed software and one question to decide right upfront is: shared memory vs message passing. Both have advantages and disadvantages, but don't mix well. We started out with message passing, but over time somebody added POSIX shared memory as a performance hack (which two processes happen to run on the same machine). Over time, we added a second, non-POSIX shared memory layer for performance reasons under Windows. It was an unmaintainable mess. The core problem was that the CTO didn't understand distributed programming well enough to push back against those performance hacks. "How do you handle software architectural leadership?" used to be one of my replies to the inevitable "have you got questions for us?" in job interviews, when I was being interviewed. Now that I am making architectural decisions myself, I put a lot of efforts into this, for example building suitable linters that flag violations in code reviews. If your team fights over cats vs scalaz or over Scala-as-OO vs Scala-as-FP then that's a sign that the technical / architectural leadership is weak. Choices like pure-OO vs pure-FP vs mixing them require care, and are hard to change in-flight. If you have strong modularisation, you can successfully use different paradigms in different modules, but strong modularisation needs care and architectural discipline, too. Part of the problem is that the style of programming that libraries like cats require (monads, functors, applicative, type-classes, HKTs) is not yet widely understood. This approach to programming needs its 'map/reduce moment' and become part of the mainstream introduction-to-programming curriculum. We'll get there, maybe in about a decade.
- nogridbag 4y agoI've returned to Java after using Clojure and Groovy for several years. I appreciate the fact that Java's just plain boring and slightly verbose. Most of the time the complexity in my code has little to do with Java being verbose and more due to the business problem. There are areas to improve and Java's been making great strides recently. For example, in Java 21 we may finally have methods like getFirst() and getLast() for lists (via JEP 431) instead of the incredibly clunky list.get(list.size() - 1). Java also recently added multi-line Strings and templating is coming shortly. Streams and Optionals also reduce quite a bit of boilerplate, e.g. Optional's map and ifPresent methods are often elegant. Really I can't think of many other areas where Java gets in the way. Our team is incredibly productive with modern Java. I think most developers actually write overly verbose code regardless of the language. And it seems little to do with years experience. This youtube channel covers most of the basics: https://www.youtube.com/@CodeAesthetic https://www.youtube.com/@CodeAesthetic To me I just follow these recommendations naturally but in most PRs I review there's often huge amounts of overly nested code, poorly named methods, etc.
- ithrow 4y agoWhat do you miss from Clojure? BTW, is that your channel?
- nogridbag 4y agoNot my youtube channel. It just showed up in my recommended videos and it seemed like good advice (common sense). It's helpful to point devs to those videos when I see them making those types of mistakes. I miss the data oriented approach Clojure libraries take. I remember having an issue with Ring and I just dove into the Ring source code and it was so simple and clear and I found the solution to my issue in minutes. I've never had that experience with Java and instead resort to forums, stackoverflow, etc. Most Java libraries would have several layers of abstraction and they're often intimidating. I consider myself an amateur Clojure dev and yet still contributed some PRs to some projects. With that said, I've written some internal tools in Clojure and it was a nightmare whenever I had to modify them. They were pretty simple CLI tools that only needed updates every 6 months or so. I usually have to spin up the project with a repl just to understand the inputs and outputs to functions. I've ported all internal tools I created at my current company from Clojure to Java and I personally find them so much easier to maintain.