4 ms·
I hate the old school way of writing Java more than any other language. I love writing in "modern" Java more than any other language. Lombok, RxJava/Reactor w
by Tsarbomb 5y ago
I hate the old school way of writing Java more than any other language.
I love writing in "modern" Java more than any other language.
Lombok, RxJava/Reactor where possible, and monads everywhere. It is beautiful and succinct, though I totally appreciate it may not always be easy to introduce on older frameworks or legacy projects.
- zaphirplane 5y agoLombok is too much magic for me, record class and the annotation generators libraries are a bit less magic
- jsiaajdsdaa 5y ago>Lombok is too much magic for me If an object is just data, then @Data is all you need. If an object crunches numbers, then @Service with @RequiredArgsConstructor if you don't prefer to @Autowired things individually. Any other usage of Lombok is possibly indicative of a questionable application design imo
- tombert 5y agoHaven't used Lombox, RxJava is great, but it just feel like bandaids on a language that wasn't really designed for it. There's no accounting for taste, but I'll take either Scala or Clojure on the JVM any day of the week. Scala's monads don't feel like a library feature, they feel baked into the language...because they are.
- softwarebeware 5y agoScala is far ahead of its time. And has been since 2014.
- deleted 5y ago[deleted]
- Cthulhu_ 5y agoLombok is indeed a band-aid that replaces IDE-autogenerated code, which in turn is a band-aid for language design choices on the one hand (e.g. equals and hashcode), and accepted Best Practices in Java world like setters/getters everywhere; for the latter, you can either do public final fields, just use public fields until you need an accessor method (java's refactorings are great), or on the other hand add language features like in C# and Scala where from a class consumer point of view, accessing a value or calling a setter/getter are the same. That said, I did hear Java is getting value types soon, or something like that. A bit too little too late maybe, but welcome nevertheless. If I had the choice I wouldn't use Java again; JVM is fine, but there's better languages for it than plain Java. Kotlin seems alright. Wouldn't use Scala again, that's a language for sadists.
- AtlasBarfed 5y agoWhy use Lombok if you can use Groovy + CompileStatic? Does lombok do anything groovy can't do?
- tombert 5y agoScala definitely has its irritations but I’ve grown to accept it. It has enough cool features to justify its existence. I’ve not used kotlin but people I respect say it’s great, maybe that’s better than Scala.
- lmm 5y agoIME Kotlin is the worst of both worlds. It's like they took every cool one-liner example from Scala and said "see, you don't need a whole functional language to do that, we can just add this piece of syntax sugar and you can do the same thing while keeping that Java feel", but once you've done that a half-dozen times you end up with a language that's actually even more complicated since it doesn't have the underlying consistent core that Scala does.
- SOLAR_FIELDS 5y agoI like Scala a lot more than I feel like I should. It’s weird to say that it’s a language that feels too academic while also being heavily used by enterprises. I used it a lot while working at BigCo and there were a lot of times that the language got in the way of getting things done due to the design. But it is really elegant once you understand it. It’s no Lisp, of course, but it feels somehow both pragmatic and academic in getting things done. And for writing Spark, it’s quite expressive.
- derefr 5y agoCan you link an example of a codebase written in this modern-Java style? I've seen parts of it here and there, but I don't think I've ever seen all this used together.
- deleted 5y ago[deleted]
- deepsun 5y agoTry Kotlin. Unlike Scala, it's not really a new language, it's more like syntactic sugar.