| ▲ | crystal_revenge a day ago |
| One thing I'll miss about this was the way this arcane writing increasingly made sense over time as you became a better programmer. I learned Java only after Python and I remember being not quite familiar with types so even the 'void' and 'String[]' where a bit mysterious. After learning basic types that part made sense. Then you start learning about Classes and objects, and you understood that main is a static method of this class Main that must be required somehow. As you dive deeper you start learning when this class is called. In a weird way what started as complete, unknowable boiler plate slowly evolved into something sensible as you began to understand the language better. I have no doubt that seasoned Java devs see a lot more in that invocation that I do. Good riddance though! |
|
| ▲ | karolinepauls 19 hours ago | parent | next [-] |
| Good riddance indeed. The last 30 years of software teaching basically trained developers to produce complexity for its own sake, while calling it engineering. I'm not sufficiently full of myself to link to my own writing (yet) but I'm full of myself enough to self-paraphrase: 1. Programmer A creates a class because they need to do create an entry point, a callback, an interface... basically anything since everything requires a class. Result: we have an class. 2. Programmer B sees a class and carelessly adds instance variables, turning the whole thing mutable. Result: we have an imperative ball of mud. 3. Another programmer adds implementation inheritance for code reuse (because instance variables made factoring out common code into a function impossible without refactoring to turn instance variables from step 2 into arguments). Result: we have an imperative ball of mud and a nightmare of arbitrary dynamic dispatch. At some point reference cycles arise and grandchild objects hold references to their grandparents in order to produce... some flat dictionary later sent over the wire. 4. As more work is done over that bit of code, the situation only worsens. Refactoring is costly and tedious, so it doesn’t happen. Misery continues until code is removed, typically because it tends to accumulate inefficiencies around itself, forcing a rewrite. |
|
| ▲ | bjackman a day ago | parent | prev | next [-] |
| I remember our "intro to programming course at university" started with this program and the tutor said "I'm mostly gonna try and explain all the code I show you, as I show it, but this is the exception, you just have to accept this nonsense bit for now". And yeah, it was pretty cool looking back on it later and realising I knew what it all meant! And yeah, good riddance nonetheless! |
|
| ▲ | raverbashing a day ago | parent | prev | next [-] |
| Except a static class method is just a hand-wavy way of denying reality: that a program has a single entry point that has nothing to do with classes As much as C++ has a lot of problems, them and other languages (python/ruby/etc) never denied that the procedural world existed, while Java wants to blindfold you and push you through a corridor until you get out of it and into the "perfect (not) OOP world" |
| |
| ▲ | Yoric a day ago | parent | next [-] | | If you're speaking of `main()`, that's not true in Java: you can have many entry points and decide upon launch which one you're using. If you're speaking of `__main()`-style entry point, though, you're right, and Java makes it... complicated. | | | |
| ▲ | mayoff a day ago | parent | prev | next [-] | | But in Java, a program doesn't have a single static entry point. You can have as many different classes as you want, each with its own static void main, and choose which to use as the entry point when you start up your JVM. | |
| ▲ | pansa2 a day ago | parent | prev [-] | | > python/ruby/etc never denied that the procedural world existed Interestingly, those two languages use very different mechanisms for top-level functions - although I’m not sure if there’s a significant difference in practice. Python has true standalone functions, whereas in Ruby’s they’re really methods of a `main` object. | | |
| ▲ | 1718627440 a day ago | parent [-] | | In python you are recommended to use if __name__ == '__main__':
sys.exit (main (sys.argv))
and not put any code that is executed at the top-level. Otherwise its also executed when you import the file. |
|
|
|
| ▲ | panza a day ago | parent | prev | next [-] |
| Yeah, I agree with this sentiment. The boilerplate was oddly helpful when I was starting out. |
| |
| ▲ | boxed a day ago | parent [-] | | That's just Stockholm Syndrome. Think about it: what more crazy garbage could you add that is useless for the beginner but "will make sense later"? The answer is: infinitely much. You could have to write each character in strings as separate characters for example. It would be absolute utter madness but it "would make sense later". | | |
| ▲ | almogo a day ago | parent [-] | | I agree specifically, but disagree generally. As we become more and more acquainted with programming, a lot of what we do why we do it is incoherent nonsense to a beginner, but important nonetheless. The limit is actually your time and effort. But nobody likes to write optimal assembly by hand, the balance has to be struck somewhere. | | |
| ▲ | boxed 17 hours ago | parent [-] | | But there is nothing important or useful in all that Java garbage. You could write entire programs without classes! That's the class, the static, AND the final keywords. You can't really escape String[], which imo is fine. It's better than argv/argc in C at least. |
|
|
|
|
| ▲ | rob74 a day ago | parent | prev | next [-] |
| Yup... if you're familiar with the old class-based approach, the new style raises more questions than it answers. Did they really turn "everything-is-an-object"-Java into a procedural language? What do you do if you do need command line arguments? Etc. (I somehow mostly avoided learning Java, and my last passing contact with it was 20+ years ago, so these are honest questions). |
| |
| ▲ | js2 a day ago | parent | next [-] | | The class is still there, implicitly. The main function can be written with `String[] args` if you need it. This is a decent summary of the changes: https://www.happycoders.eu/java/main-method/ Further details: https://openjdk.org/jeps/512 | | |
| ▲ | xiphias2 20 hours ago | parent | next [-] | | ,,Since an implicitly declared class cannot be accessed from outside, it must always contain a main method.’’ This looks like a hack just for the main file, it would have been good if these functions can be called from other files. | |
| ▲ | AstralStorm 21 hours ago | parent | prev [-] | | And now to know what it does you have to read a book. The IO class is good. The rest is information hiding.
Now if you could write anything else in Java in this form,it would make sense. |
| |
| ▲ | bilekas a day ago | parent | prev [-] | | If it's anything like dotnets change the void params are still a valid input. |
|
|
| ▲ | Joel_Mckay a day ago | parent | prev [-] |
| In general, Java made OO design trivial to implement, but due to a clear specification standard requirement a lot more planning/time is needed. Thus, many sub-optimal project coordination approaches ended up fighting the design patterns. Java is a good student language, but there are so many better options now... with fewer footguns, and without Oracles farts. =3 |
| |
| ▲ | vkazanov a day ago | parent | next [-] | | None of the Java and OOP problems were created ar Oracle. As much as I love hating Oracle, they pushed the language forward much more than Sun ever did. | | |
| ▲ | Joel_Mckay a day ago | parent [-] | | Interesting opinion, but that is only applicable for enterprise clients. The public gets a NERF'd legacy option full of known problems, limitations, and legal submarines. The only reason Java is still somewhat relevant is ironically Android/Kotlin, and SAP/heinous-dual-stack-blobs product lines. Best regards, =3 | | |
| ▲ | vkazanov a day ago | parent | next [-] | | It is not "an interesting opinion". It is an opinion of a mid-level engineering manager who spent the last decade hiring and building teams across various parts of the industry. Java/JVM is literally everywhere. And let me get this clear: not a fan of both java-the-language and java-the-culture. | | |
| ▲ | Joel_Mckay a day ago | parent [-] | | Interesting perspective, the exact same argument was made for COBOL and Fortran. Most Enterprise level Java I saw was not clean OOP, but rather a heinous kludge sitting next to a half-baked design pattern. The 3.6B Android OS users in the world probably are more relevant in terms of development projects, and keeping your team staffed. Good luck =3 | | |
| ▲ | vkazanov 19 hours ago | parent [-] | | I am not speaking of some legacy systems, java is THE language right now, the same way Fortran was the only one in the first couple of decades of existance. Besides, what is "clean OOP" even? | | |
| ▲ | Joel_Mckay 17 hours ago | parent [-] | | In my opinion, ideally a well-planned/templated object structure focused around well documented design-patterns without bodged-on/polyglot binary objects. Thus, people that actually leveraged the OO paradigm properly, and in a way that may be sustainably regression-tested/maintained over many continuous integration cycles. That kind of "clean" code tree usually only needs juniors to study around <5 files to understand even the most complex modules operation, helps mitigate bugs, and team-leads can weed out quality "issues" in minutes. People that churn teams usually discover a YOLO and OO paradigm are fundamentally incompatible concepts. People won't know everything they need in the first release, and they will have stuff they don't need but now have to live with by the third release. This is not a Java specific problem... but it does make it easy. Nothing integration "teams" do will likely matter much compared to a 3.6B user-base policy change. Have a great day =3 "Nor would a wise man, seeing that he was in a hole, go to work and blindly dig it deeper..." ( The Washington Post dated 25 October 1911 ) |
|
|
| |
| ▲ | ludovicianul a day ago | parent | prev [-] | | While Android/Kotlin keeps Java in the spotlight, Java also powers financial services, high--frequency trading systems, payment gateways, logistics platforms, and even modern microservice deployments. These are not all “legacy”,they’re mission-critical platforms handling billions of transactions daily. | | |
| ▲ | Joel_Mckay a day ago | parent [-] | | The exact same argument could be said for COBOL and Fortran. >high--frequency trading systems Probably not the Java stack itself, given GC latency and precision timing skew would translate into millions of lost dollars a second. However, people do silly things in the wrong languages all the time. =3 | | |
| ▲ | npstr a day ago | parent | next [-] | | It looks like you're not up-to-date, ZGC has pauses on the microsecond dimension.
Even since before ZGC was added, there are open source libs for HFT that optimize allocations to avoid GC: https://github.com/openhft =3 | | |
| ▲ | Joel_Mckay a day ago | parent [-] | | Indeed, it is likely some naive kludge like RTSJ Tend to deprecate Java services for a number of other reasons =3 |
| |
| ▲ | Yoric a day ago | parent | prev [-] | | FWIW, I've seen job ads for Java developers in HFT. It did look weird, of course, but they're also using Go (which iiuc has worse GC latency) or other garbage-collected languages (OCaml being a famous example). | | |
| ▲ | Joel_Mckay a day ago | parent [-] | | The "heinous-dual-stack-blobs" joke refers to loading native binary objects in the JVM, but its probably some newer naive kludge like RTSJ. I guess it is like using a Fiat Coupe as a gravel dump-truck. lol =3 |
|
|
|
|
| |
| ▲ | znpy a day ago | parent | prev | next [-] | | Java is essentially open source enough that you can ignore oracle. All the development of java happen in openjdk, of which oracle is a contributor (along with red hat and many others). Oracle’s java is just an openjdk distribution, with some additional proprietary bits. Pulling the oracle card when java is mentioned is a useless stunt. | | |
| ▲ | Joel_Mckay a day ago | parent [-] | | The OpenJDK has come a long way, but is still less than ideal. Do you actually use that option at enterprise scale? =3 | | |
| ▲ | fiddlerwoaroof a day ago | parent [-] | | Everywhere I’ve worked has used Eclipse Temurin or another open source release: the Oracle JVM isn’t used all that often because of license issues. | | |
| ▲ | Tostino 20 hours ago | parent [-] | | Ditto. Even things like Java flight recorder are open source now and work with any JDK distribution. | | |
|
|
| |
| ▲ | mfru a day ago | parent | prev [-] | | So tell us what the better options are in your opinion? | | |
| ▲ | Joel_Mckay a day ago | parent [-] | | A lot of folks prefer Scala or Kotlin even on a janky JVM. Depends on the use-case, but I also like Elixir/Erlang, Julia, and Go. Not all are very popular, yet each offer something uniquely beautiful. =3 | | |
| ▲ | mfru 18 hours ago | parent [-] | | Yet the only ecosystem with a mature library for every use case under the sun and that is not riddled with footguns is Java. (One might argue Go comes close, though) Javas selling point is that it can do everything reasonably well and has a huge talent pool. |
|
|
|