13 ms·
If you're disabling GC, why use Java at all? That's the point of using Java (or any interpreted language), isn't it? Avoiding manual memory management? If yo
by na85 11y ago
If you're disabling GC, why use Java at all?
That's the point of using Java (or any interpreted language), isn't it? Avoiding manual memory management?
If you're going to go through all that horrid FactoryFactory Factory = new FactoryFactory(); bullshit, might as well get the benefits of the GC.
And if you don't want the GC, why not write your code in something else?
- recursive 11y ago> If you're going to go through all that horrid FactoryFactory Factory = new FactoryFactory(); I get the impression that your only exposure to java is through jokes and blogs from dynamic typing evangelists.
- gravypod 11y agoIf you give Java a try, it's got a lot more impact than Factory. Play around with the language a bit, there are things in the JVM and the language that really change the way you think about programming.
- smac8 11y agoI'm a fan of Java in some senses, but curious to here what things you discovered in the language or JVM that changed how you thought about programming
- ysleepy 11y agoFor me it is the vastly superior tooling. * Best IDEs around. (Yes better than .net ecosystem) * JVM monitoring (Flight Control, VisualVM) * Performance Sampling/Profiling <1% perf cost * actually being cross platform (yes, mono, bla)
- threeseed 11y agoAbility to use Clojure, Scala, Freje, Groovy, Java, Javascript, Python etc all on the one platform and share libraries and objects between each other. People forget that Java has the best ecosystem of libraries bar none especially when you get into the more enterprise areas e.g. Big Data.
- gravypod 11y agoOne-and-done is my favorite way of thinking about using Java. The JVM provides the perfect, for my use case, amount of abstraction from the hardware while still allowing you to do some amazing things. There is also a huge amount of features that are supported by the JVM that Java still doesn't make use of. There is also a great JIT and garbage collector.
- smac8 11y agoYes, but I suppose this is more the JVM than the language itself. The JVM is quite convincing though, hence Clojure, Scala, etc.
- Roboprog 11y agoSure. I now know: * What a great feature function pointers / procedural types / other call-by-name/reference-mechanisms were. (J8 lamdas are used like function references, but are kind of heavy) * What a source of mystery "annotations" are. Java started out like an interpreted version of Delphi or UCSD Pascal disguised as a cleaned up C++, but since 1.1 it evolved slowly and/or in the wrong ways. Actually, as somebody who has been programming since 1983, in quite a few languages, Java brought little to nothing new to the table. Nothing personal against you, I'm just sick of the Java language/syntax and how it failed to live up to the hype.
- tinco 11y agoThere are no popular languages that both have no GC and are comfortable to work in. Rust is going to be one, though I feel it's not entirely comfortable yet. Garbage collection is just one of the things that make languages like Java comfortable to work in, but certainly not the only thing. Disabling automatic garbage collection in Java or C# I feel is a very effective way of gaining most of their advantages while limiting the effects of the runtime on the variability of your execution time. Java is not an interpreted language by the way. FactoryFactories are a choice, not necessarily forced by the language.
- asveikau 11y agoComfortable is a relative term. There are people comfortable working in C or C++.
- tinco 11y agoTrue, there's a relevant photograph here[1]. Although I think that even those when they fall asleep or otherwise let their guard down their programming experience can get real uncomfortable real quick. 1] https://en.wikipedia.org/wiki/Bed_of_nails#/media/File:RGS_13.jpg https://en.wikipedia.org/wiki/Bed_of_nails#/media/File:RGS_1...
- ryao 11y agoHow is your statement not one by someone who would find the modification of any language considered comfortable to remove garbage collection and require explicit free operations to render it uncomfortable? Also, Java is interpreted at the byte code level by default. The way the hotspot JIT works is by detecting hot areas of code and then doing JIT to be compiled.
- ScottBurson 11y agoWhat sense does it make to speak of a language as being interpreted or compiled? These are attributes of an implementation. The existence of GCJ, a native-code Java compiler that's been around for years, proves this. It's true there are languages that are essentially uncompilable, and so have to be interpreted. Perl is the best example I can think of; there are constructs in the language that can't be parsed correctly without runtime context. Python, Ruby, and JavaScript are all difficult to do AoT compilation on as well, at least if you want to do much optimization, but I wouldn't agree that they can't be compiled. But Java is not as dynamic as these languages.
- exception_e 11y agoThat factory code you mentioned isn't _just_ a Java thing, but a very well-known and wonderful design pattern. Wikipedia says it best: "[The] Factory pattern deals with the instantiation of object without exposing the instantiation logic." Practical benefits: - Can help rid of excessive switch and if/elseif statements and splits up your logic - Eliminates new keyword to improve testability
- anonymousab 11y agoAs with most language jokes/prejudices, I think the hate comes from seeing the misguided, incorrect or unnecessary uses of that pattern. Java's prominence in the corporate world means sturgeon's law is more apparent.
- exception_e 11y agoNever heard of that law. Brilliant.
- Roboprog 11y agoBecause Java is the new COBOL -- especially if you statically allocate everything for performance reasons. At that point, you really are left with something not unlike COBOL with separate compilation and the ability to allocate scratch counters (or other primitives) on the stack locally, but all of your main data is still copy books^H^H^H^H^H^H^H beans allocated in the DATA DIVISION.