7 ms·
It's my theory that Java, unintentionally, did a lot of damage to P&L research. I write a lot of Rust, and while the borrow checker is great, I've come to reall
by nemothekid 4y ago
It's my theory that Java, unintentionally, did a lot of damage to P&L research. I write a lot of Rust, and while the borrow checker is great, I've come to really admire the work that was put in the Go GC even if it's not as fast Java.
There is a whole generation of programmers that have come to equate GC with Java's 10 second pauses or generics/typed variables with Java's implementation of them. Even the return to typed systems (Sorbel, pythons' typing, typescript) could be seen as typed languages are great, what we really hated was Java's verbose semantics.
- chrisseaton 4y ago> P&L research What’s P&L? > Java's verbose semantics Does Java have verbose semantics? I think Java’s semantics are pretty neat and concise. Where’s the verbosity?
- mandevil 4y agoNot OP, but someone who has gotten paid to write Java for several years. I would say that isn't that Java's semantics are that verbose, it's that the way Java is traditionally written, with every line actually 3 lines on your screen of public function makeItalicTextBox(String actualTextIWantToBeItalic) { ItalicTextBox itb = italicTextBoxFactoryGenerator.GenerateFactory().buildItalicTextBox(actualTextIWantToBeItalic); return itb; } I think this is actually the pernicious work of Martin's _Clean Code_ which trained a whole generation of Java coders to write nonsense one line functions with a million interior function calls like this, not anything forced by the Java language itself, but it makes for really ugly code, in my exceptionally humble but undoubtedly correct opinion.
- deleted 4y ago[deleted]
- musicale 4y agoThe builder pattern with method chaining is unfortunate and should usually be replaced by named/optional parameters, in any sensible/modern programming language at least. IDEs are an enabler for horriblyLongIdentifierNames because they enter them for you automatically without requiring you to type them on a keyboard.
- becquerel 4y agoCan you explain why you feel this way? I personally hate named and optional parameters, as they inevitably seem to drastically inflate the complexity of the function. I would much rather deal with a builder class that encapsulates doing something over calling a method with fifteen parameters, half of which are optional. And god forbid you have optional bool args! If I need to call a monster like that repeatedly, I'm likely to make my own wrapper that's simpler anyway - so why not start out that way.
- musicale 4y agoOne thing I like is that: foo(a=1, b=2, c=3) is shorter (and, I would argue, clearer) than foo().a(1).b(2).c(3) and requires only one method declaration and one method call. Also for constructors you don't have to worry about partial or out-of-order initialization. Is the above the same as foo().c(3).b(2).a(1) ?? What if one call involves opening a file or allocating some resource that is used by another call? One nice thing that method chaining does give you is being able to differentiate external and internal parameter names. Swift (for example) supports this with argument labels for doing things like insert(something, into: list, at: position) rather than having to use the variable name: insert(something, list:list, pos:position) Of course I wish that Swift supported ObjC/Smalltalk-like syntax so you could just do insert a into: list at: position Note SwiftUI actually uses method chaining for some reason. It's OK but I would have been fine with named parameters. But I do like Smalltalk's method chaining/cascade syntax: robot walkForward; wave; sitDown.
- thirdmunky 4y agoJava idioms are one contributing factor. There's some inherent wordiness too - for example, Hello World in Java is wordier than in most other programming languages.
- chrisseaton 4y agoThat's syntax not semantics though.
- thirdmunky 4y agoagreed, I think everyone under the child comment of yours is talking about the verbosity coming from non-semantic stuff.
- coding123 4y agoThis is one of the reasons I left Java after 30 years. For those that wonder my day to day is now python and typescript.
- badpun 4y agoJava is 27 years old though?
- lumost 4y agoIt’s gotten better over the years. Java originally did not have generics, then there was the factory/uml everything crowd. Recently modern Java has been evolving towards ergonomics with streams/loom/guice/Lombok etc. However we still don’t have something like auto/let from cpp/rust.
- chrisseaton 4y ago> However we still don’t have something like auto/let from cpp/rust. But things like auto are more verbose semantics, not less! And isn’t var in Java like auto in C++?
- kaba0 4y agoThere is type inference for local variables indeed with var in java for a few versions now (from the top of my head it is available since 14?)
- mypalmike 4y agoYes. And you could use Lombok to do the same before that. (Though I'm one of the weirdos who likes Java in it's explicitness, which is related directly to its verbosity. I like reading code where I can see what the local variable types are.)
- kaba0 4y ago(I believe it depends on the exact scenario. In cases where the return type is not obvious I also much prefer explicit types (eg. ConcrType a = someObj.someMethod() ), but I don’t find A a = new A() any more readable than the var version)
- mypalmike 4y agoAgreed. I'm not sure that the shortcut existing in the language is worth the fact that other devs on my team will use it in the former case.
- nemothekid 4y ago>What’s P&L? I meant PL research as in programming language research. Not sure why my brain decided to put an & there. >Does Java have verbose semantics? I think Java’s semantics are pretty neat and concise. Where’s the verbosity? `FizzBuzzEnterpriseEdition` and is a meme for a reason. That said I'm sure Java idioms written today is a lot more sane than they were around the time everyone decided to rewrite everything in Ruby. When I say Java here, I'm talking about an era of Java that probably no longer exists (the JVM also doesn't have 10 second pauses today either and is widely considered the best garbage collector ever built).
- ncmncm 4y ago"Profit and loss"
- bitcharmer 4y agoBeen working in fintech (HFT) for well over a decade. Never seen profit and loss abbreviated to P&L. It was always PnL
- ElectricalUnion 4y ago> what we really hated was Java's verbose semantics I believe it's actually the opposite - Java has pretty simple, compact and well defined semantics. Too simple and compact for confort - a little syntatic sugar would have made the language a lot less verbose.
- ncmncm 4y agoJava's fundamental problems are well beyond reach of any syntactic sugar.
- forrestthewoods 4y ago> There is a whole generation of programmers that have come to equate GC with Java's 10 second pauses Anyone who has ever shipped a C# Unity game know the pain that is the garbage collector. It’s effectively impossible to avoid frame hitches with the GC. I’ve spent a LOT of time going way out of my way to avoid any and all garbage collects. Which somewhat defeats the purpose of using a GC-based language. I definitely would say “GC used to be bad but now it’s good”. That tale has been spun for 30+ years at this point!
- nemothekid 4y agoI don't know much about the C# garbage collector; and it's likely that garbage collectors are a bad fit for programs that have hard deadlines. That said, it could also be a function of the same "problem" Java has in its design - Java by default boxes everything and so every memory allocation increases garbage collection pressure. Go, by using escape analysis and favoring stack allocations, doesn't have this problem and has had sub-millisecond pauses for years now. You rarely hear people complain about Go's GC despite it being much less mature than the JVMs. But due to actual language design, Go's GC does much less work. I wouldn't say “GC used to be bad but now it’s good”, but that "the design of languages like C# and Java were too dependent on using the GC for memory allocations, and there are other GC languaged out there that utilize the GC less which can lead to greater performance"
- rdw 4y agoYou're right, and it's got more layers than that. C# does have value types, which are not boxed, and using them judiciously can avoid garbage. However, they are a more recent addition to the language (which started as a lame Java clone), and so the standard library tends to not know about them. Really trivial operations will allocate hundreds of bytes of garbage for no good reason. Example: iterating over a Dictionary. Or, IIRC, getting the current time. They've been cleaning up these functions to not create garbage over tiem, of course, but it's never fast enough for my taste and leads to some truly awful workarounds.
- 4y ago
- RandomBK 4y agoI feel that every time we talk about Java, we should clarify between Java the language, Java the programming style, and Java the JVM. As a language, Java's not too bad. It's a bit wordy, in bad need of some syntax sugar, but it's designed to be fairly straightforward and for the most part it does its job well. I don't need a degree in language theory to get started writing it. Java the programming style, particularly enterprise, is a horrendous over-engineered mess that schools jam down the throats of students who don't know any better. It's designed to (and fails to) enforce a common style that can be written by armies of mediocre developers plodding along inside giant enterprise codebases, so that no matter who wrote the code, some other developer in another department can figure out how to call it. Java the JVM is a pretty nifty beast. It's made tradeoffs that means it's not always suited for every use case, but put in its element it really shines. The modern GC algos give developers options based on the program's needs. It's currently struggling to overcome some historical decisions that while good back in the old days are now holding it back. Personally I'm very biased towards Kotlin, which gives me the benefit of the JVM without the barf that is Java. It's not the fastest-executing language out there, but for me it's a perfect balance between development speed, ecosystem of battle-tested libraries, and competitive execution speed.
- al_mandi 4y agoJava (the JVM) doesn't really have 10 second pauses anymore. G1GC and ZGC and Shenandoah have been a thing for a while now.