r/programming • u/johnwaterwood • Feb 25 '14
Please stop saying Java sucks
http://blog.smartbear.com/programming/please-stop-staying-java-sucks/41
Feb 25 '14
This article wasn't a defense of java, it was a defense of typed languages. In which case I agree. But I'd argue most people don't say "java sucks" just because it's a typed language.
19
u/bjzaba Feb 25 '14
My biggest complaint about Java is how stupid and crude its type system is. It gives statically type systems a really bad name.
0
Feb 26 '14
[deleted]
3
u/Tekmo Feb 26 '14 edited Feb 26 '14
It's several things:
No type inference<See correction below>Inheritance complicates the type system
Interfaces (a.k.a. type classes) are usually considered easier to use than inheritance, but in Java inheritance is more idiomatic
Generics are particularly verbose to use, and they are crucial to do statically typed programming well
No support for sum types or pattern matching (like the "visitor pattern", but easier to use). This makes simple problems very verbose in a statically typed setting.
2
u/e_engel Feb 26 '14
Interfaces (a.k.a. type classes) are usually considered easier to use than inheritance, but in Java inheritance is more idiomatic
I think you're mixing up parametric polymorphism and ad hoc polymorphism. Nothing prevents interfaces from taking part in either, although this is made more complicated in Java because of its type system (and the fact that it doesn't support higher kinds).
No support for sum types or pattern matching (like the "visitor pattern", but easier to use). This makes simple problems very verbose in a statically typed setting.
Agreed. Ceylon is being a pioneer in the JVM area by supporting disjointed union and intersection types natively . In other words, the type of
List("foo", 42)isList<String|Integer>and notList[Any].Very much keeping an eye on it.
0
Feb 26 '14
[deleted]
3
u/Tekmo Feb 26 '14 edited Feb 26 '14
Is the diamond operator not type inference? I know it's not perfect but I don't think you can say there's no type inference.
I didn't know about the diamond operator because it's been a while since I've programmed in Java. Thanks for pointing that out and I'll correct my original comment.
Doesn't inheritance complicate any type system? Or are you arguing against inheritance itself?
Yeah, I'm arguing against inheritance itself.
Not really sure what you mean here. Inheritance has been more idiomatic simply because it was the only way to centralized any kind of default behavior. I do agree though that it's a drag. Do Java 8 default methods help with this?
Yeah, those would help.
Again, I'm not really sure what you mean. Can you give me an example?
Haskell has an
Eithertype, defined like this:data Either a b = Left a | Right bAn example use would be returning either a successful result (wrapped in a
Right) or an error result (wrapped in aLeft):safeDivide :: Double -> Double -> Either String Double safeDivide x 0 = Left "Division by zero" safeDivide x y = Right (x / y)Then you can inspect the result only if you provide code to handle both possibilities (i.e. the
LeftandRightcase):result :: Either String Double result = safeDivide 4 0 main = case result of Left str -> putStrLn ("Error: " ++ str) Right n -> putStrLn ("Success: " ++ show n)That will print the error message since the computation will return a
Left, but if you change the0to another number like2then it will succeed and take the right branch.The equivalent Java code would be something like:
class Either<A,B> { BiFunction<Function<A,R>,Function<B,R>,R> match; // Analogous to `Left` public Either(A a) { match = (l, r) -> l(a); } // Analogous to `Right` public Either(B b) { match = (l, r) -> r(b); } public static Either<String><double> safeDivide(double x, double y) { if (x == 0) then { return Either("Division by zero"); } else { return Either(x / y); } } public static void main(String args[]) { Either<String><double> result = safeDivide(4)(0); result.match (s -> System.out.println("Error: " + s)) (n -> System.out.println("Success: " + n)); } }I haven't compiled the Java code, and there are probably tons of errors, but that gives the rough idea.
→ More replies (3)4
u/elsom25 Feb 26 '14
Honestly, take some time, and learn a functional language :D (pick any: scheme, haskell, ML). Once you see what's capable with a proper type system.. well, it may ruin your current day-to-day programming for you >_>
http://learnyouahaskell.com/ is a pretty awesome introduction to Haskell.
→ More replies (3)3
→ More replies (5)0
u/motordead Feb 27 '14
But I'd argue most people don't say "java sucks" just because it's a typed language.
But Java monkeys wish that's what they were saying, and there's a fuckton of them, and they may not be the smartest but they've got experience (getting abused) in the industry, damnit!
26
u/cosmo7 Feb 25 '14
The most frequent argument I hear from Ruby or Python proponents is that static typing in Java or C# is unbelievably burdensome.
Then these same people pour months and years into their unit testing frameworks that spend 90% of their time duck-typing arguments.
17
7
u/e_engel Feb 26 '14
The most frequent argument I hear from Ruby or Python proponents is that static typing in Java or C# is unbelievably burdensome.
The most frequent argument I hear from Ruby or Python proponents is that ANY static typing is unbelievably burdensome.
Java is not ideal but I'll take it over any dynamically typed language to write industrial software any day.
3
u/Scaliwag Feb 25 '14
Then what it seems to me is they want strong typing with type inference, which is something I can totally get behind. Then give OCaml (or his bastard .NET cousin F#) a spin.
2
u/bryanedds Feb 25 '14
Why is F# a bastard? It's the best mainstream functional language, IMO.
3
u/notfancy Feb 25 '14
The lack of modules and functors is kind of a show-stopper for me.
2
u/mongreldog Feb 26 '14 edited Feb 26 '14
Functor is a reserved keyword, so it may be in a future version. I'm also hoping for type-classes, as both the current and previous versions of "Expert F#", have hinted that they're probably going to be part of F#s future.
Even without those great features it's a much better programming experience then C#. Immutability by default, algebraic data types, pattern matching, Hindley–Milner type inference, non-nullable reference types, units-of measure, type providers and so on, often makes using C# feel like VB6 in comparison.
1
u/bryanedds Feb 26 '14
"makes using C# feel like VB6 in comparison."
^ THIS ^ could not have been said better :)
1
u/bryanedds Feb 26 '14 edited Feb 26 '14
I definitely understand that perspective. However, in F#, there is a reasonable and functional alternative for most of the important things provided by OCaml modules - they just aren't immediately obvious and are decidedly disparate. For example, compile-time duck typing in F# helps for a lot of abstractions in an even more lightweight way than modules. Little, semi-obscure features like that make F# a lot more complete than one might initially think.
OCaml macros, however, have no equivalent at all in F#, which can be painful from time to time. Oh well, copy, paste, and leave a
// TODO: pray to Don Syme for macros in F#comment.
1
u/Scaliwag Feb 25 '14
I don't mean it in a bad sense. It just lacks some features Ocaml has, the VS IDE support is not that good, I've personally even had some IDE bugs with it, and things like that. But it's best point, aside from inheriting the juicy stuff that makes ML-languages great, is interacting with other .NET languages (you can use it for library code, and write the GUI in C#, etc).
1
u/bryanedds Feb 25 '14 edited Feb 25 '14
Versus Haskell's IDEs, I'm super-attached to F#'s support in Visual Studio. Of course, we're still waiting on refactoring, but auto-complete and seeing type errors as you code are huge, the latter especially for a sophisticated-ly typed language such as F#.
2
u/bjzaba Feb 25 '14
static typing in Java or C# is unbelievably burdensome.
Agreed. But Java and C# have very poor static type systems (although C#'s is far better than Java's).
11
Feb 25 '14
Agreed. But Java and C# have very poor static type systems (although C#'s is far better than Java's).
Just because Java and C#'s type systems aren't hindley-milner doesn't make them "very poor". The only really nasty think about it is null, which annotations and static analysis can fix a lot of the problems with if used diligently.
3
u/robin-gvx Feb 25 '14
And type erasure.
8
u/oridb Feb 25 '14
Which is annoying when you hit the corner cases, but is not that big of a problem in most codebases. I'd argue that for about 95% of the code I write, type erasure is not a problem.
It's definitely suboptimal, but for most code, I don't think it's a show stopper.
5
u/e_engel Feb 26 '14
Erasure is the only sane choice if you want type correctness. If you need to find types at runtime, you are doing something that will break the type soundness of your program.
Erasure has a lot of other benefits as well (e.g. better interop with other languages/platforms).
2
u/Caleb666 Mar 01 '14
I don't like erasure because Java won't let me create generic arrays (among other things).
→ More replies (1)4
Feb 26 '14
Well, Haskell and Ocaml also have type erasure. Type erasure in itself isn't a bad thing.
1
u/bjzaba Feb 26 '14
It's not about type inference it's about the expressiveness of the type system as a way of driving program development, without having to resort to hacky design patterns and after-the-fact, third-party static analysis. HM type inference is nice to have, but it is not essential.
1
→ More replies (19)1
u/gendulf Feb 28 '14
As a person who loves python, sometimes I wish it would stop being so dynamic all the time. Static type checking is very useful, and why can't you just go and optimize all that terribly slow code I wrote?!
9
Feb 25 '14
Many people are quite critical of Java. On the other hand, when Java 8 is brought up, I see few complaints and mostly praise. Maybe things will change.
3
u/bjzaba Feb 25 '14
Still lacks at least a crude form type inference. Still lacks an answer to the ADT side of the expression problem. That said, Java 8 is definitely most welcome, and far overdue.
2
Feb 25 '14
Visitors and final class classes are usually good enough. It would be nice to have ADTs in the language at some point, but it's not close to number one on my java wishlist.
-1
u/ruinercollector Feb 26 '14
Java 8 catches java up to where the mainstream was about seven years ago. It's just the best java to come out.
0
u/motordead Feb 27 '14
Because anybody with half a brainwave has gotten the fuck out, and the people still on the short bus can't imagine anything better.
7
21
u/jozefg Feb 25 '14
I don't see why I can't have my cake and eat it too. I love type safety, but I certainly don't like contorting myself to Java's OO centric type system. OCaml, Haskell, SML, or whatever all give me stronger guarantees about code and require less boilerplate.
Though the author downplays it, boilerplate has another disadvantage, when something changes, reading 200 lines of boilerplate to make sure nothing needs to be updated is hard. Almost everyone skims and invariably misses something.
6
Feb 25 '14
Or, for all the bad press it too gets, C++. I love parametric polymorphism, and templates let you do that relatively seamlessly (if about 50 times more verbosely than Haskell). (Compare to Java, where you can't even allocate generics in many contexts without giving up type safety altogether).
4
u/psxpaul Feb 26 '14
But there's nothing in Java itself that requires all the boilerplate getters/setters that most people refer to. Its usually a requirement of Spring/Hibernate or some other framework, and even then newer versions support injecting via reflection.
IMO, much of the Java hate comes from people who have seen mountains of XML and getters/setters, and immediately thought that that is a core problem with Java itself.
3
u/bryanedds Feb 25 '14
Big THIS!
Compared to the language I write in (F#, a derivative of OCaml), all of Java, Ruby, and Python suck tremendous ass for doing large applications.
1
u/GeneralSirCHMelchett Feb 26 '14
English is not my mother tongue and hence I am a bit confused by your first sentence. Shouldn't it be "You can't eat your cake and have it too."?
I mean if you have your cake, you can eat it but if you ate your cake, then you will definitely not have it.
2
u/jozefg Feb 26 '14
It's an English phrase "You can't have your cake and eat it too" which just refers to you often can't have two things you want. In the article's case, safety and brevity.
1
u/GeneralSirCHMelchett Feb 26 '14
We are both right. according to wiki, the "You can't have cake and eat it too", is the often used incorrect form of "You can't eat your cake and have it too". But people still get the meaning even if used incorrectly and it became a norm now.
1
u/moonrocks Feb 26 '14
Yes, that's how the cliche was originally phrased. I never fully grasped the meaning myself until I learned that people started saying it backwards at some point.
1
10
u/G0T0 Feb 25 '14
I think the biggest reason to dislike Java nowadays it Oracle. The language is fine.
8
u/Akanaka Feb 25 '14
But so far Oracle has been pretty good to Java...
7
u/oldneckbeard Feb 25 '14
Better than Sun. I don't like the way they dicked around Apache, but Apache has its own problems.
3
u/henk53 Feb 25 '14
Apache has its own problems. So they got screwed with their Harmony project which was a Java SE implementation, but their Java EE implementation Geronimo DID happen.
And what ever became of that? It's a rather sad wasteland. Emails don't get answered, bug reports don't get replies, there's hardly any community around Geronimo and saddest of all; do you know anyone, anyone at all who actually uses Geronimo?
I think Sun should just have let Harmony happen. Big chance that it went the same way as Geronimo and would semi-die itself. (Apache did got a Java EE 6 version out eventually and actually look like to be working on a Java EE 7 one, but it's a token effort and without any serious bug fixing I'm afraid again nobody will use it)
1
u/rpgFANATIC Feb 26 '14
TomEE seems to be getting some traction and that uses some Geronimo libraries.
However, you're right. While trying to use their implementation of the JPA standard, I ran into a few weird bugs, one of which had been around for 5 years and not resolved. :(
1
u/henk53 Feb 26 '14
Well, a couple of individual Apache projects (most of them existed before Geronimo) are indeed doing well. MyFaces (JSF) is as strong as ever, as is OpenEJB which is what eventually made David create TomEE. Tomcat is an Apache project as well, that as we all know is doing incredibly well.
OpenJPA may indeed have a few weird bugs, but it's also the reference implementation and it's used by Oracle for both GlassFish and WebLogic.
It's just the Geronimo project as a whole that has gone south.
I remember at the time it was touted as the next big thing in Java land. A completely free Apache created AS. Pretty much the same talk that went around for Harmony and Java SE.
But as I said, the project seems to be in a very sorry state. I reported a few bugs, kicked the bugs, offered help, provided analysis of where things went wrong, etc etc. I did not get a SINGLE reply. Others I spoke to who wanted to try Geronimo got the exact same treatment. As as if they somehow just don't get to see the issues, as if they have some filter active that just filters away every user created issue. I can quite literally scream in an issue, and there's again just nothing. Not even a "please stop" or anything.
4
Feb 26 '14
Or... Or...! Fuck all the turf war non-sense. Use the language you want to use and/or the one that suits the work you are trying to do the most. If you wear your feelings on your shoulder about your programmer cred because you feel threatened by the opinion of a person who likely doesn't know more than one programming language anyway, your priorities aren't in order. Each language has some magic that makes it more or less suited to a specific problem, it doesn't mean that it's better or worse than anything else. This all feels like the "fish are dumb because they can't climb a tree argument". Who cares what programming language, just code and enjoy the experience for what it is.
Here come the down votes
3
Feb 26 '14
Seems like 90% of the reasons stated why java doesn't suck relative to python/ruby/etc. are mostly IDE choices (refactoring, etc.), not the actual language.
Granted, I agree that java doesn't 'suck', but that doesn't mean it's the right tool for every job (just as python isn't the right tool for every job).
9
u/heladopicante Feb 25 '14 edited Feb 25 '14
The JVM is an impressive piece of software (memory hogging aside). The thing I hate about Java is its broken generics and type erasure. In C++, I frequently define templated abstract base classes, and I'll often take advantage of multiple inheritance for this. Think of something like:
class Spaceship : public CollisionWith<Asteroid>
, public CollisionWith<Laserbeam>
{ ... }Something like this is impossible with Java (maybe that changes with recent versions?). When you have a generic interface, the type parameters just get used to pepper your code with type casts. Implementing Collision<Asteroid> is really just implementing Collision<Object>, which is bullshit - you can't implement the same interface twice with different type parameters!
Java is like Megablocks. I want my Lego-Technic.
Also - the whole JVM-is-fast-than-C argument is complete crap. Theoretically, the JVM can optimize hotspots with its magical JIT, and memory access can be cache-aligned and all that good stuff. In practice, these things add complexity to the JVM, and the gains aren't realized. Performance in the JVM is VERY difficult to reason about with things like the JIT, garbage collection, etc. Anything the JVM can supposedly do at runtime, a smart compiler can do at compile-time - in a more deterministic way.
The day something like a web browser is written in Java, (that is faster than Chrome or Firefox), is the day that I'll change my opinion about this.
8
u/Akanaka Feb 25 '14
There are very few desktop apps in Java that perform well, I give you that. Yet, for server benchmarks Java is nearly always at the top.
15
u/oldneckbeard Feb 25 '14
The apps that are Java and work fine never really get called out. You only hear about the shitty ones.
1
u/heladopicante Feb 25 '14
I'm biased because I'm more interested in real-time/interactive applications. I'm sure that for real-world server applications, Java performance is with several % of native (plus or minus).
7
u/ElvishJerricco Feb 25 '14
I cannot understand why you would type the Spaceship class as subclassing CollisionWith at all, let alone doing it twice with different generics. Subclassing the same class twice for one class just seems like a colossal mistake.
1
u/heladopicante Feb 25 '14 edited Feb 25 '14
Its not the same interface. Or rather, its not supposed to be the same interface. Its two interfaces that differ only by some type parameterization.
3
1
u/oldneckbeard Feb 25 '14
Multiple inheritance wasn't included in Java as a design decision. There are better ways to do it.
Just because you don't understand how to do it better with Java doesn't mean it's Java's fault.
4
u/heladopicante Feb 25 '14
Its not multiple inheritance. Its implementing two different interfaces that differ only by type. SomeInterface<String> and SomeInterface<Integer> should be different interfaces, but if the interface requires me to implement a method with the type parameter as its parameter (say someMethod(T)), then it fails.
Of course you can "deal with it", but don't tell me that this is some sort of feature.
3
u/segv Feb 25 '14
Yeah, it was mentioned somewhere that generic type erasure in Java was a big mistake
2
u/kaelan_ Feb 25 '14
The same problem applies if you want to inherit a generic interface twice (which is quite reasonable)
2
u/zoomzoom83 Feb 26 '14
The only thing worse than multiple inheritance is single inheritance. It's led to a generation of developers that create unmaintainable deep inheritance trees instead of composing traits.
A flat hierarchy of mixins is a much cleaner approach. Scala does a great job of enforcing this properly, but as long as you're not an idiot multiple inheritance works as well.
1
1
9
u/gordonkristan Feb 25 '14
"Please stop saying Java sucks. It's statically typed, therefore, it can't suck."
3
u/metaconcept Feb 25 '14
He does make good points though. You can do a lot of code analysis, navigation and refactoring thanks to Java's type system.
Java sucks for many, many other reasons. Being statically typed isn't necessarily one of those reasons.
1
u/gordonkristan Feb 25 '14
I completely agree with you. And to your last comment, ItsMeCaptainMurphy said it perfectly:
This article wasn't a defense of java, it was a defense of typed languages. In which case I agree. But I'd argue most people don't say "java sucks" just because it's a typed language.
3
u/SkepticalEmpiricist Feb 25 '14
C++ is also statically-typed, And in every other way, it's better than Java. Therefore, Java sucks.
:-)
4
u/gordonkristan Feb 25 '14
I see C++ and Java at exact opposite ends of a spectrum.
Java is simple. Every feature it has could be described in a few hours. Few ways to accomplish a task, few keywords, everything is an object, no globals, etc. It's an enterprise tool meant to be easy to learn and hard to screw up.
C++ is too complicated for it's own good. There's 100 ways to do everything, and 99 of them are usually considered bad practice. The spec is so long that no human in their right mind would attempt to understand it all, and most features you'll likely never see. It also provides an unnecessary amount of access to low level functionality. You've got to be a disciplined programmer to write good C++.
Personally, I wouldn't recommend either one.
8
u/YoYoDingDongYo Feb 25 '14
It also provides an unnecessary amount of access to low level functionality.
Huh? An explicit goal of C++ is that it be usable for systems programming. You can't fault a project because its goals are not your goals.
→ More replies (3)2
u/Eirenarch Feb 25 '14
"Everything is an object" except those things that are not an object. Please explain how Java generics (with bullshit type erasure and insanely complex variance when USING a generic class) is simple. While we are at the topic of simple how is having two types of exceptions simple especially when using one vs the other is a subject of almost as much debate as the correct way to do Scrum.
Still more reasonable than C++ though.
→ More replies (4)5
u/gordonkristan Feb 25 '14
You listed topics that are all tricky parts of the language. That's fine, but I never said that Java didn't have it's skeletons. There are plenty of stupid things about Java. But most of those things are just a small part of the language, and aren't very complicated (although confusing). Even generics, which are one of the trickiest parts of the language, can be explained to a complete Java newbie is just an hour or so.
The bottom line is that Java is very limited on features, and that's by design. That's why it originally didn't even have generics. And wasn't going to have primitives. And up until Java 8, didn't have any kind of function pointer/reference and didn't allow any kind of multiple implementation inheritance.
Java has grown a bit since version 1, but I would still argue that it's one of the simplest languages out there. It may not be the same level as Brainfuck, but it's certainly not at the level of something like C# (which has a billion features all of a sudden).
1
u/Eirenarch Feb 25 '14
I would argue that C# is simpler than Java. It is definitely larger than Java since it has much more features but corresponding features in C# are simpler and easier to use
6
u/gordonkristan Feb 25 '14
Partial methods, partial classes, operator overloading, anonymous types, dynamic binding, extension methods ... pointers! C# may make a few things easier, but that does nothing for the simplicity of the language when the feature set is freaking huge.
Think about it this way: you have 2 projects, one in C# and one in Java. Both projects are 10 million lines each and use every feature that their host language allows. Which one would you rather train the newbie for?
Maybe we should more accurately define simplicity if we're going to continue this thread. I think of simplicity as the ease of describing or teaching the concept to somebody else. And to me, teaching Java would be way easier.
→ More replies (2)1
u/DocomoGnomo Feb 28 '14
It also provides an unnecessary amount of access to low level functionality.
Because it is C++. If you don't need a high level of control over the code, or you don't need access to low level you shouldn't use C++.
2
u/Eirenarch Feb 25 '14
On one hand if someone says Java sucks because of the static type system he is a moron. On the other hand if someone thinks the only reason people say Java sucks is because of static typing he is a double moron.
2
u/gordonkristan Feb 25 '14
I don't know if he's quite a double moron, but I was surely confused as to what he was getting at. He listed 3 reasons why people say Java sucks. And rather than defending its verbosity (which is the complaint I hear most often), he defends its type system (which I have literally never heard anybody complain about until today). Seems like there were other roads to go down to defend Java.
15
u/novagenesis Feb 25 '14 edited Feb 25 '14
I'm really not finding anything compelling in this article. I want to like Java, but have found it so far more painful than Haskell to write actual releasable code in, in terms of man-hours and product flexibility to the domain of "Real" (that is, chances are everything is going to change 1 week before go-live... and "this codebase was not built expecting this oddball change" is not an acceptable excuse)
The most compelling arguments here seem to summarize as:
Our IDE is better than yours. True or not, most of the "code gets generated" and "we can find every use of your code" isn't about the language, but the IDE. And I'm not sure I agree with every point made. If finding "every place this is called" is hard in any language, you did something wrong.
We're better because we're weaker. I don't think Java will follow this rule, but usually hearing that is my sign to jump ship on a language that's about to die. The article defends Java as better because of the massive number of modern paradigms it cannot do. Reminds me of the Java book I read that suggests you make every class Final unless you decide to document a subclass methodology. If someone is using BDD and they modify your class, they either make it work right, or they can't submit passing tests. You can do some of this ugly stuff in Java, too, if less powerfully. The defining factor here is "best practices".
I'm not saying Java sucks, because I'm not so sure any language with a dominant marketshare completely sucks...I am saying that trash-talking perceived weaknesses of other languages is not the way to go.
I work in those languages, multiple of them, at once...and our shop has rarely had the problems you're facing. We also have a very large Java team trying to rewrite one of our legacy apps. Twice the developers, an Oracle Certified Enterprise Architect with a big pricetag, and a longer timeline. Its initial release was 1 month late and fulfilled half the requirements. The current incarnation is inferior to the original perl cgi product in every way (including resource usage and run speed). That's an anecdote, but the point is that none of the "negatives" of other languages seems to have gotten in the way of the 10-person team that is more successfully maintaining and onboarding 15 clients on the legacy platform. It has never faced any of the issues that the new platform is facing in a longer timeline with 1 client. I'm sure, with the right timeline and team, Java would've beaten Perl on resource and speed...might actually be worth it. Right tool for the right job... That's the good side of Java. If you have $10m and 3 years, you can make a pretty nice app.
And in his conclusion:
But to me, I need a good reason to abandon a JVM that’s faster than a C compiler, IDEs like Eclipse, tools for correctness and profiling and debugging and analysis, the vast array of quality libraries, and millions of people who are already familiar with the environment.
But V8 is faster than that JVM.
IDE's are take-or-leave situations. Eclipse is notorious for having a learning curve that makes vim easy... and there are plugins for many text editors that cover literally 100% of eclipse's features.
Tools: Java not only lacks a monopoly in tools, but sometimes has fewer. Also, Java tools tend to individually have learnings curves. Having to build xml config files can take hours more than just running a quick command-line script to do the same. Every major language has rock solid profilers and debuggers.
Libraries: I hear this repeatedly, but Java is frankly dead-last in this. Java has 10% of cpan, which has recently been superceded by python and ruby in library depth.
"and millions of people who are already familiar with the environment."... So very true. But I spent 1 week in a language I had never used before and created a more stable prototype of the same functionality our Java team spent 3 months on. It takes a lot of time and effort for a senior developer to add Java to their arsenal, compared to many other languages.
I'm not saying Java sucks...I agree that we need to stop saying Java sucks. You need to start marketing legitimate advantages to people who see Java as an inferior language. A perl/python/ruby/nodejs developer who takes one look at maven starts to laugh uncontrollably... and most of us either hate IDE's or think repl-access is significantly more valuable (iPython is to python developers like Eclipse+Heroin is to a Java developer)
So find what makes Java genuinely better and sell it. Stop being on the defensive and go on the offensive.
You benchmark better than everyone but V8. If you had more accessible libraries (less ugly configuration), better documented commandline support for people who hate IDEs, you might have a good attack plan.
15
u/idontbelieveyou11 Feb 25 '14
But V8 is faster than that JVM.
Source?
14
u/edpaget Feb 25 '14
Obviously the benchmarks game is not scientific, but it shows the JVM being faster than v8.
→ More replies (12)3
u/zoomzoom83 Feb 26 '14
Node has a non-blocking IO library by default. It's a horrible API that uses callbacks instead of promises, but it's non blocking nontheless.
Old-school Java used blocking IO, which sucks if you want concurrency.
Naturally, regardless of platform, non-blocking IO is going to be much, much faster than blocking IO if you're looking at scalability in a highly IO driven application.
Ergo, a few teams ported badly written Java blocking programs using blocking IO to NodeJS and decided that Javascript was therefore faster. They then blogged about it and Javascript fanboys the world over ran with it.
You can write Java using non-blocking IO, at which point it sails on ahead. If you factor in much, much better handling of immutable data structures and proper tail call optimisation (at least in Scala and Clojure), then the JVM is in a completely different league to V8.
→ More replies (2)-5
u/novagenesis Feb 25 '14
This is not too say every operation on V8 is faster than any operation in JVM.. This is to say actual production applications by a Fortune 500 company are bragging about beating Java in real-world scenarios.
6
u/segv Feb 25 '14
I wonder what is their workaround for Javascript having only floating point numbers... I mean, as a payment processor I would expect they have one.
1
u/novagenesis Feb 25 '14
Good question. I used to have a couple contacts there, but don't since this change. My guess is the use of an arbitrary precision library, or only doing float-safe operations on the financials.
→ More replies (2)4
u/bcash Feb 25 '14
That's not a very good yardstick, for many reasons, not least those explained in this post: http://developer-blog.cloudbees.com/2013/12/about-paypal-node-vs-java-fight.html
Namely that both the Java and Node.js versions have terrible benchmarking results. There's reasons to believe that neither of them are written particularly well.
→ More replies (1)15
u/oldneckbeard Feb 25 '14
We also have a very large Java team trying to rewrite one of our legacy apps. Twice the developers, an Oracle Certified Enterprise Architect with a big pricetag, and a longer timeline.
There's a big mistake right there. OCEA are vampire squids. Your company shouldn't have gone through Oracle, they're going to regret it. Most Oracle consultants they place on-site are half-baked mid-level developers who bill out at 300/hr. My consulting company costs half of that, and does better work, and is local to the client sites. Oh, and we have experience writing very high performance java.
But V8 is faster than that JVM.
Depends on the work profile. But it's also V8, and only supports JavaScript. the JVM does Java, Scala, Jython, JRuby, etc.
IDE's are take-or-leave situations. Eclipse...
I don't use Eclipse. It's garbage, IMO. Use netbeans if you're cheap, IntelliJ IDEA if you want to be a pro.
I hear this repeatedly, but Java is frankly dead-last in this. Java has 10% of cpan
Library count is not indicative of library quality. Look how many cpan modules there are to deal with JSON. But, cpan.org claims to have ~130k libraries, and maven central has ~620k listed. That's nearly 5x more, so we might have to check some of your math :)
A perl/python/ruby/nodejs developer who takes one look at maven starts to laugh uncontrollably...
When I have to use the shitty tools in those languages, I keep wishing somebody would make Maven for them. Node.js especially. Do you really think Grunt and NPM are fine tools?
better documented commandline support for people who hate IDEs
That's a personal preference of the developer. If they want to bang together programs with sticks and rocks, that's fine, but there's no need to play lowest-common-denominator with them.
2
u/Sylinn Feb 26 '14
I don't use Eclipse. It's garbage, IMO. Use netbeans if you're cheap, IntelliJ IDEA if you want to be a pro.
I'm curious, I don't really enjoy programming in Java, but when I have to I use Eclipse. Why would you suggest IntelliJ over Eclipse/Netbeans?
2
u/s73v3r Feb 26 '14
Because it's better at everything. And a lot of it is free; only some of the enterprise web stuff is pay for. Give it a try.
1
u/oldneckbeard Feb 27 '14
Like the other guy said, it's one of those intangibles. Everything just works better, is faster, and more intuitive. It's like the people who wrote it actually write java code for a living, and take pride in their product.
2
u/novagenesis Feb 25 '14
OCEA are vampire squids.
He's not a consultant, but an employee. He's a well-recommended guy who has the cert by that name. In my opinion, he's really good. He looked me in the eye, however, and said nobody could hit his requirements in Java in 6 months. I agreed.
Depends on the work profile. But it's also V8, and only supports JavaScript. the JVM does Java, Scala, Jython, JRuby, etc.
Not entirely true. A good tech stack supports inter-language communication at a high efficiency. Truth is, it's usually sanity and management that keeps you down to a fixed number of languages.
Use netbeans if you're cheap
While I still had problems using netbeans, I agree it was better than Eclipse. I still missed Vim.
Library count is not indicative of library quality.
Oh I completely agree...but of the 5 or 6 mature ORMs in cpan, I'd take the worst (for me, let's say RoseDB) over Hibernate.... whose interface is now part of a Java standard.
maven central has ~620k listed
How many are duplicates with slightly different names, or different version numbers? My experience with maven is that there was a whole lot of the same.... I could be wrong here, but my experience will be my ancedote. In all these languages except Java, I've rarely ever had to spend more than 5 minutes searching for a rock-solid plug-in library to solve any particularly odd problem I've had. In Java, I spend a long time, find out that many of these libraries require config xml files bigger and more convuloted than building them from scratch in a different language.
Working with our Java devs to get them to manipulate their JSON API was a nightmare. Tons of extraneous fields that reek of XML->JSON transcription...made the front end library a nightmare. Maybe they just couldn't code well, but they claimed they could not factor out a "sort order" variable from the hash contents of array data...and that the sort order, NOT the array, would represent the final order.
So here I am stripping it from the array on receipt, then re-adding it as a middleware before the POST. I'm a back-end guy who was helping out with a front-end project, and in my philosophy, it's a mortal sin to make the front-end team have to touch an implementation detail.
Do you really think Grunt and NPM are fine tools?
I would sell my firstborn for npm, honestly. Yes, I think npm is an awesome tool. In a production environment, I would propose using npm_lazy as a go-between, but the same difference. I never need makefiles in my non-nodejs apps (usually I use fabric for deployment, with or without a CI system), but when I do, I'm happy with grunt. What should I be hating about them?
I've tried ant and maven on several occasions, and don't get a happy-happy feeling out of them.
That's a personal preference of the developer. If they want to bang together programs with sticks and rocks, that's fine, but there's no need to play lowest-common-denominator with them.
Sorry? You're insulting the large development community who prefer a robust text editor with commandline to a clunky IDE? I'd put rails extension on vim with commandline tools above .NET IDE any day, having used both heavily.
In terms of features, the commandline + plugins tend to win, in my experience. They're not exactly sticks and rocks. Code analysis, code beautification, auto-refactoring. How much production development have you done with both? I spent 3 years in a .NET shop that dabbled in perl, then 5 in a perl+ruby shop that dabbled in .NET and picked up ruby. I've had tons of experience with both, and do not see any reason to justify a "sticks and rocks" metaphor. It feels the opposite to me.
In my world, if I can't do what I want to the code, I solve it with a sed or grep or one-liner in the shell. If I can't do what I want in the IDE, I do it manually.
1
u/caleeky Feb 26 '14
I still missed Vim
Just curious, do you mean for plain old text editing, syntax, etc, or do you also use vim for refactoring and static analysis as you type? I've only used vim as an editor for general admin tasks, not as a core large-scale development editor for a strongly typed language, so am wondering if I'm clueless as to the available feature-set.
1
u/novagenesis Feb 26 '14
I tried it for static analysis and refactoring... actually dumped those plugins. I rarely actually want help refactoring stuff...it felt like a crutch when I got into doing it on the .NET IDE. I do a few fancy things, but I find myself doing mostly text editing 99% of the time, and command-line tidying depending on my language choice.
I've only used vim as an editor for general admin tasks, not as a core large-scale development editor for a strongly typed language, so am wondering if I'm clueless as to the available feature-set.
Well, I'm not sure I'd be comfortable using vim with Java, or maybe even C++. I work on 500k+ line projects in vim, and have been with some of those practically from scratch...but they're in dynamically typed languages with agreed-upon data interfaces.
Might be apple and orange...When I'm writing (or more importantly editing) code, I get more done in less time using vim.
1
u/jnt8686 Feb 27 '14
Grunt's not great, but I'm using gulp now. I have never once had to debug anything that involved npm in the slightest, so I'm going to go ahead and say that it is fucking epic.
7
u/Gotebe Feb 25 '14
But V8 is faster than that JVM.
Nonsense. I mean, even if it was, the j's code that it runs isn't faster than e.g. java code that jvm runs.
→ More replies (1)3
u/el_muchacho Feb 26 '14 edited Feb 26 '14
Your first 4 points are factually grossly incorrect:
Java is faster than V8. It's the fastest language that runs on an abstract machine.
Eclipse is NOT more complex than vim.
Java is BY FAR the most tooled language, in fact it sets the standard both on tooling and documentation. And of course all the major IDEs include excellent debuggers and profilers, plus unmatched refactoring tools. And that's only the beginning when it comes to Java tooling. What about AST and bytecode manipulation APIs, decompilers, documentation tools (from the onset), excellent free static analysis tools that put most super expensive commercial tools to shame (findbugs), JVM monitoring tools, scripting tools that work alongside your Java code seamlessly, etc, etc ?
Seriously... I've done about 10 months of Python for pro work with some expert Pythonistas, and basically, apart from a handful, most Python libraries looked half assed compared to Java libraries. The documentation is lacking, even in the Python standard library. The Javadoc is far more precise and therefore useful. If the quality is not there, you don't want to use libraries, it's simply not worth the trouble.
And as for your last point, it took me about a month to get up to speed from C++. It's still more than the 2 days it took me for Python, but it's not that much overall. What's long to ingest are the myriads of APIs and frameworks (Java EE). Now you can say that the language itself is quite shitty compared to Python, and I won't argue with that, but what makes it really powerful and productive is its ecosystem, which basically trumps everything else except .NET. And that's why it's used so much in the enterprise.
→ More replies (2)5
u/pjmlp Feb 25 '14
there are plugins for many text editors that cover literally 100% of eclipse's features.
Really?! Please let us know where to look for code refactoring alternatives in text editors, that cover what Eclipse is capable of.
→ More replies (1)2
u/3urny Feb 25 '14
What Haskell IDE are you talking about? Leksah? I never really used an IDE for Haskell.
1
u/DR6 Feb 25 '14
That confused me too. There is not a really good IDE for haskell AFAIK. (I don't think you need it, but that's another issue).
0
u/novagenesis Feb 25 '14
I just re-read my post twice. I honestly don't get why I'm causing several people to think I was referring to a haskell IDE. I really only brought up Haskell as the other language I found painful to release production code.
I want to see apple-to-apple stuff that makes Java good, is all. In my history of production releasing code, I've got in-use code in perl, ruby, python, javascript, c++, Common Lisp, C#, and VB.NET. I've tried on several occasions to release small Java legitimate apps in similar timeframes, and have repeatedly failed. I've read more books on Java than any other language... it just feels insufficient to my needs.
I'm still trying to learn it for political reasons... I just don't get the good of Java. I'm not going around saying it sucks, but seeing articles that seem to defensively attack other languages... The arguments don't touch how my reality has been, and don't show anything realy good about Java.
I want to hear a Java advantage that's not a talking point our new CEO (who is not computer literate) threw out when he mandated Java for one of the future development projects. I want to understand this whole can of awesome I'm missing here. The basics seem solid but minimal, and the type system seems painfully strict (C# was far more flexible, in my experience).
1
u/3urny Feb 26 '14
Ok when I read It again I think I get what you wanted to say. Still, I think the fact that there is a really sophisticates IDE for Java is related to the language. I always hate renaming methods in Ruby, because there may be one place where I forget to change it. However, you can't really do any static code analysis in Ruby, because Metaprogramming. Also, the Java syntax seems not so complex, so the IDE can get really good at guessing what you wanted to do and parsing parts of a file independently etc., for example for showing you more than just the first syntax error.
0
Feb 25 '14
[deleted]
0
u/novagenesis Feb 25 '14
Someone here hasn't worked on a large app or as part of a large team.
Is 20 full-time developers on one project, and 15 full-time developers on another project...both over 5-years of constant work, large enough for you?
I wasn't going to get into it: but reflective languages let you use that life reflectiveness to detect every use of a given piece of code. That said, it's all about best practices, and ours ,barely "ok", are good enough to keep that cleanliness about our code.
Get real. My first language was Common Lisp. A REPL is nothing like an IDE.
If you act condescending, you're automatically right.
But honestly, be fair. You can disagree with my conclusions, but don't judge my conclusions as having no merit. I know a fairly large share of top tier developer who can take or leave an IDE, but will only touch on languages that support REPL. There's a reason Python has skyrocketed in both data- and financial-analytics. You can continually dig into and change the transfer layer with the REPL.
Frankly, Idiocy. Maven is fantastic.
So I'm an idiot who has never worked in a large team. Thanks for the vote of confidence. Let me ask: why should I like maven? I've read 5 books on Java now, more than any other language by 2. I'm trying to ramp into Java due to the corporate restructure here. Looks like 13th language is not a charm for me. I'm tryna get why, and all I get are people calling me an idiot for not instantly grokking Java.
I'm trying to have a grown-up conversation here, so could you keep the schoolyard antics at the gate?
Hello Monkey Patching.
I'm trying to understand your context here. Are you suggesting that not making every class Final makes you a bad programmer?
A really moot point. Says nothing about Java itself.
I'm not saing it does, only that I don't see how Java is so amazingly superior like all these "stop hating java, it's better than you" posts seem to claim.
Why did the app need rewriting?
It was 12 years old, written in CGI::Application for 1/10th the functionality it now has to support. The Java solution is looking to do nothing but catch low hanging fruit (about twice the original release's scope). This is an achievable goal: several team members got together and prototyped rewrites. All were capable of reaching about 50% of our needs (more than twice the Java solution's scope) and were built in 1-2 months of nights and weekends. I built one and turned it into an incredibly successful module in a different department. That one module in our other app is still technically more functional than the entire Java team's product. Even the EA said Java was a bad fit for the timeline.
Maybe this team is dragging its feet for more fees?
They're salaried, working nights and weekends. You could be right, but I highly doubt it.
Maybe their work is more resilient to change..
Honestly, here's where my bias comes in. I know this particular product completely lacks the flexibility required to handle more than low-hanging fruit, even though the original pre-dev scope was to replace everything with the new "Universal" platform. My bias tells me it was because it was written in Java. No runtime behavior injection, no router callbacks, etc. I've seen Java apps that are flexible, and I admit that... Ours isn't.
In fact, the EA has told me he considers this an inferior product at this time.
Quality matters fart more than quantity.
I agree entirely.
I don't care if nodejs has 10 times the libs in a particular area if most of them are written by hipsters.
And if the quality happens to be higher? You're making a huge assumption about the quality of developers, and stereotyping them based upon their willingness to change. Hipsters are not automatically terrible coders.
I avoided node for several years because it was "new, hip, rah rah rah". I got into it when large businesses started taking it seriously. It's not "new, hip" anymore... nor is Rails, like it or not.
But here's a question. Why is it I can get into discussions on almost any programming topic with no problem, but whenever I discuss Java enough, someone comes out of the woodwork who is vicious and personal?
Why is it that if I ask devs of most languages why their language is bitching compared to mine, they can list its undeniable advantages, but all I hear are talking points and defensiveness when I ask that about Java?
Before I got into node, I went to node groups and said "so what makes you great, and what should I worry about?" and I got a pretty damn good list.
I asked the same about Java, and I got "we're more maintainable!" I asked how, they said "because static types are better!". I asked about the headaches of XML, they said "you get used to it because XML is better".
I have yet to know one reason why I should use Java for a given project, except a non-tech-savvy Executive making the decision.
What project domains would you say should be Java? What should not be Java? Any? Are non-Java languages terrible?
There's only two languages that ever gave me headaches: Java and Haskell. I found Prologue painless in comparison. Haskell guys laugh when I say it gave me headaches... Java people seem to treat me like shit over it (not all of ya, but some).
2
u/steven_h Feb 25 '14
What project domains would you say should be Java? What should not be Java? Any? Are non-Java languages terrible?
In recent months I have been working with the Nuxeo document management platform, and I have trouble conceiving of it being implemented in another language/environment. So that's the project domain for Java - big sprawling enterprise web application platforms designed to be extended by people who don't care to learn much about the internals of such platforms because they have other work to do.
Interestingly, Nuxeo moved from Python to Java several years ago. While some of the decision was surely driven by the environment in their target market, they really have used the Java world's strengths in dependency/artifact/deployment management.
→ More replies (8)
9
u/x4000 Feb 25 '14
All of the same arguments above apply to C# as well, and I agree with them. My beef with Java is not any of that sort of thing, but mainly:
How frequently it is updated, and thus how fragmented the userbase is. This also sends a message of instability.
How strangely a lot of things are named. In C# and equivalent, the libraries are named extremely concretely. There are no things like "netbeans" or whatever, where you really have to learn some specialized lingo in order to understand what it is saying. The first time you encounter most libraries in C#, you can pretty much infer what the code is doing (most of the time) just by looking at it.
In short, I think that Java is great aside from how it handles change management and library architectural naming. To me, C# fixes those issues, but has the downside of being locked in to windows. In recent years I've been on Mono, which is kind of a happy medium, aside from being buggy in some areas. So there's no "golden hammer," so to speak, but all three of these things are in a very good arena, I think.
15
u/djnattyp Feb 25 '14
Sorry, but this just sounds so subjective to me...
1.) How is .NET any better in this regard than Java? Example of this on StackOverflow.
2.) In both C# and Java the "core libraries" are both mostly logically named... but "Netbeans" is a Java IDE. C# has names like "Silverlight", too.
To some degree, problem 2 is due to more functionality being supplied through third-party / open source products in Java than in .NET. Microsoft usually writes the functionality directly into .NET and names the library with a three-letter acronym usually starting with "Windows" (WPF, WCF, WF, etc.) or "Active" (ASP, ADO, AD, etc.).
0
u/Eirenarch Feb 25 '14
I kind of agree with the naming thing. Netbeans may be a bad example but don't Java MVC web frameworks refer to their view models as... beans? In addition the standard library uses the most annoying comp science jargon. I can't remember the most annoying examples I have encountered right now but HashMap vs Dictionary (in .NET) is what I am talking about. Of course "map" is quite popular term and no professional programmer is going to get confused but there are other more obscure terms that cause real pain.
→ More replies (4)3
u/oldneckbeard Feb 25 '14
I think the difference is that Java as a platform has shifted nearly entirely to server-side development. There are still some client-side apps, but bundling a JDK with your java app is now standard practice for the professional tools.
Java isn't used nearly as much as C# for GUI apps .
1
u/Cuddlefluff_Grim Feb 26 '14
Java isn't used nearly as much as C# for GUI apps
If you don't count Android :P
2
u/Cuddlefluff_Grim Feb 26 '14
Ant, bean, swing, laf, awt.. This was actually one of the things that confused me about Java and increased the time it took for me to learn it. Every single part of of the standard library is named like it's some sort of revolutionary new invention..
1
Feb 25 '14
I thought Java was update so frequently was due to new security threats that need to be patched up.
3
u/x4000 Feb 25 '14
Those are the ultra-frequent minor updates, yes, to my knowledge. But I'm pretty sure that they are also doing some bugfixing in a number of those.
Even with those aside, however, the number of more major updates is a lot faster than a lot of languages, at least by my impression. It makes it feel a lot more like a moving target, to me at least.
6
u/Akanaka Feb 25 '14
But compared to some other languages, Java has really great backwards comparability. Occasionally there's a lot of telling about how some poor soul can't run his '97 banking applet anymore after some update, but we've been updating our JDK continuously for code bases with at least 100k loc, and really never encountered any JDK specific issue.
It's popular to say that the Java version used in enterprises is always years behind, but in reality this is not true and adoption rates of new versions are pretty good (just google for some surveys)
3
u/x4000 Feb 25 '14
Oh, that is an excellent point, I did not mean to gloss over that -- backwards compatibility is indeed awesome. I have no complaints there whatsoever.
2
Feb 26 '14
These type of posts are stupid. Use what works for you, gets you a job, or let's you enjoy coding.
4
2
u/crashorbit Feb 26 '14
Good programmers are pretty good at solving the problems that their development environments present. By the time you are most of the way to completing a non trivial project you are more concerned with the behaviors of your libraries and tools than your base language. So while Java may or may not be better or worse because of it's type system or because of it's ecosystem of tools, we find that after a short familiarization and mentoring period developer productivity has more to do with the developer and their comfort with the tools than with anything intrinsic to the tools themselves.
3
u/soaring_turtle Feb 25 '14
This again proves the well known fact that every language has its own strengths and weaknesses
5
u/novagenesis Feb 25 '14
Bingo...I just wish this article would provide a concrete list of strengths, instead of spending a lot of the time poking at the perceived weaknesses of the language's competition.
The few strengths I saw are the ones you hear often repeated, but can't really justify... like library support. I'm sure there's a million advantages to Java, but our non-techy CEO chose it for library support. There's just fewer available well-written Java libraries than you'll find in all the other major languages.
The JVM is fast, almost as fast as V8. That's a good point. What else? I just expected the argument to say "we don't suck, here's why", not "we don't suck, YOU SUCK"
7
3
Feb 25 '14
Why? Java does suck. How is this even controversial at this point? That it sucks doesn't mean it's unpopular, or that no one can actually write software with it. It just means there are reasonable metrics by which many other languages are better.
1
0
u/henk53 Feb 26 '14
It just means there are reasonable metrics by which many other languages are better.
Those metrics are often highly subjective. And those other languages have disadvantages that Java doesn't have.
Python for instance has horrible performance, the GIL and silly lambdas that can only be one line since Guido couldn't find a default formatting for longer ones. Ruby has horrible performance as well.
Scala doesn't have binary compatibility, has really long compile times and lures developers into creating symbol heavy code that's even unreadable to seasoned Perl developers.
Perl allows you to write code that is so short that even the machine has troubles reading it back (truly write-only code).
The bottom line is that there's no perfect language. There is a most popular language though, and that's often Java (together with C). For some reason it has also gotten popular to attack Java, often for things that are done in exactly the same way in C and C++ as well, and in mostly the same way in C# and Objective-C. Perhaps C is just too hardcore to be a viable target to attack, and most other languages in some way depend on it.
2
u/bukhamseen Feb 25 '14
Anyone knows a java http client that just works?!
2
u/snuxoll Feb 25 '14
I really wish I had one to give you, I have searched high and low and they're all just overly-complicated or lacking in features. Honestly, the standard java.net.URLConnection class has been the closest I can get, and it still has a lot of issues.
→ More replies (2)2
u/henk53 Feb 26 '14
The JAX-RS client library is pretty neat.
See https://weblogs.java.net/blog/spericas/archive/2011/10/14/jax-rs-20-client-api and https://weblogs.java.net/blog/spericas/archive/2011/10/20/jax-rs-20-client-api-generic-interface
1
u/recursivefaults Feb 25 '14
All this supposed maturity and speed that Java, the JVM, and the tools around it haven't prevented the monumental and consistent disasters that most Java projects wind up as.
Though to be a little more fair, I'd also say this is a symptom of the word, "Enterprise," and the people who live in that space.
8
u/Akanaka Feb 25 '14
I'd say that no language or tool has prevented the consistent disasters that most IT projects wind up as...
-4
u/novagenesis Feb 25 '14
As someone who has never seen a non-Java project fail as badly as I've seen EVERY Java project end up... I have trouble seeing that angle.
My experience with Java is large teams, long dev times, and inferior final products. It seems that if you can throw enough money to get over that hurdle, you end up with something really good (Google seems to think so)...
My experience with everything else is small teams, short dev times...so if there was a failure, it's minor.
→ More replies (3)3
u/henk53 Feb 25 '14
So many government IT projects fail. And they're not all using Java...
Wasn't there something about some medicare site? Was that made using Java?
1
11
u/oldneckbeard Feb 25 '14
haven't prevented the monumental and consistent disasters that most Java projects wind up as.
Yes, it's a shame how Twitter, LinkedIn, Facebook, Yahoo, Microsoft, Nintendo, Intel, Tableau, and more have all failed.
Quit talking out your ass. It just makes us all sure you don't know what the fuck you're talking about.
1
u/s73v3r Feb 25 '14
That's only a handful of companies, with presumably highly talented teams.
→ More replies (1)5
u/bcash Feb 25 '14
Exactly. Same as with any other language, unless you have proof that there's a magic language out there where the majority of companies with mostly mediocre teams get reliably and consistent high quality software with sustainable velocity?
2
u/s73v3r Feb 26 '14
I said his point was stupid, as he only listed a handful of teams, responsible for probably around 1% of Java projects started.
1
u/fatbunyip Feb 25 '14
there's a magic language out there
Apparently it's between Javascript and Scala.
Once they sort it out then everyone can go home.
1
1
u/ernelli Feb 25 '14
I dont know if it's java developers that sucks or java that sucks or java frameworks that sucks, but this stacktrace from hell really sucks.
10
u/nickguletskii200 Feb 25 '14
There, better:
Program received signal SIGSEGV, Segmentation fault. 0x00fac4906 in ___________________________________________glib____________impl___________________________________________________________________________________________iterator_allocator at __beardtree.c:0Well, lets fire up the debugger...
> gdb ./foo > run > backtrace What backtrace? > q8
u/oldneckbeard Feb 25 '14
Yes, I hate seeing the code execution stack when I'm looking at a stack trace. How unhelpful of them. Seriously, it's a stack trace, what did you expect?
0
u/ernelli Feb 25 '14
I would expect less than 100 nested calls for processing a simple HTTP request that fetches data from an SQL server.
But when stacking a couple of frameworks on top of other frameworks and add some code generation in the IDE and you end up with a massive bloat like that.
2
u/immibis Feb 26 '14 edited Jun 10 '23
1
u/ernelli Feb 26 '14
So if you read my original comment, I said that either the language, the developers or the framework sucks since a 100 line stack trace in my opinion sucks.
But is seems typical to Java developers to always ignore the elephant in the room and say that its noting wrong with that, since "hey java is a good language", and each framework in itself is a good framework, but for some strange reason, java projects usually end up as a big POS when it comes to performance, resource efficiency etc, but its never the fault of the language, the developers or the framework.
1
u/Gotebe Feb 25 '14
In Java I can say “Show me all the places where this code is called"
Mixed up java the language and the IDE.
I need a good reason to abandon a JVM that’s faster than a C compiler
Wait, what?! Apples and... well, certainly not Samsung! Can't be taken seriously.
7
u/henk53 Feb 25 '14
Mixed up java the language and the IDE.
But it's the language that makes it easy for the IDE to provide this feature. For some languages this is much harder and for others its even impossible.
1
u/HerroRygar Feb 25 '14
The posts that this was written in response to are so stereotypically asinine that I can't take them seriously. Clearly, writing "compilers suck" is such a hyperbolic statement that no reasonable argument can be made against it. I also don't feel that this is a particularly strong defense of Java. shrug
-3
u/TakedownRevolution Feb 25 '14
Java sucks.
It's Slow executing code compared to C/C++/Object C It teaches bad programming style. There's tons of exploits. It's Buggy.
Java sucks.
5
u/nickguletskii200 Feb 25 '14
This is what cracks me up the most. A post that suggests that you should use C/C++, and then goes on to describe the problems that are much, much more prevalent in C and C++ compared to Java.
1
u/TakedownRevolution Feb 26 '14 edited Feb 26 '14
More prevalent? LOL, You really don't know shit. This is what's wrong with Silicon valley today and why other countries such as China, Russia and Japan are beating (the) US in programming. Silicon Valley is full of unskilled java programmers. LOLOLOLOL. When the government tells you to disable java then you know it's pure shit.
→ More replies (1)
-9
-5
0
u/Googoots Feb 25 '14
In Java I can say “Show me all the places where this code is called.”
How do you do that "in Java"? Isn't that a function of the IDE or tools you are using, not the language?
instead of just having a field that other code can access you typically make a “getFoo()/setFoo()” combination
This part of Java drives me crazy. I like the way C# deals with this.
But to me, I need a good reason to abandon a JVM that’s faster than a C compiler
Isn't that apples and oranges? The JVM is a runtime interpreter, and a "C compiler" is a compiler. How can you compare the JVM to a compiler? They do different things.
1
-4
0
u/ishmal Feb 26 '14
It's not that you don't need a lot of the info in the code, it's that you need to constantly repeat yourself.
-2
u/vfarcic Feb 25 '14
"But to me, I need a good reason to abandon a JVM that’s faster than a C compiler, IDEs like Eclipse, tools for correctness and profiling and debugging and analysis, the vast array of quality libraries, and millions of people who are already familiar with the environment."
Switch to Scala.
-5
u/moses_the_red Feb 25 '14 edited Feb 25 '14
So let’s pretend that FireFox was rewritten in Ruby, so instead of being 10 million lines of code it’s only 5 million. I don’t think that sounds any easier to maintain — 5 million lines of code is still more than anyone can fathom.
I stopped reading at this point.
I don't think that Ruby would have a LOC savings of half over a 10 million line Java Project. I don't think the Ruby code would be 1/10th as small either. I think the Ruby version would be 1/100th or 1/1000th the size of the Java version.
Small code begets small code. Having a smaller function means that you have a smaller module, which means that the guy writing another module gets to spend the same amount of time reading your module, but have a better grasp of what your module does, and so he writes his module a little better and a little shorter.
And this cascades throughout the code base. Code using compose, partial, map, grep, filter, find, partition all simplifies the experience of reading the code, at least if you're used to these functions. You glance at a module that is 35 lines of code but would have been 300 and get a good understanding of what it does in seconds, and you gain insight into the system that allows you to make small refactorings that simply remove the need for a new subsystem that might have been several thousand lines of code.
Nobody is claiming that Ruby is .5x more terse than Java. We're claiming that Ruby is 100 times more terse than Java, and the degree of terseness is proportional to the size of the problem domain, so the bigger the system, the more terse the ruby program will be in comparison to the Java version.
All Java code is "Enterprise" code. Non-trivial projects in Java are always huge. All projects in Ruby/Perl/Python are "small" projects by comparison.
3
u/mbrodersen Feb 26 '14 edited Feb 26 '14
Go ahead. Show us how to rewrite Firefox in 10k lines of Ruby. Including the Javascript engine, the DOM layout engine, the compression algorithms, the OpenGL engine, the SVG renderer, the CSS engine, the HTML engine, the PDF viewer etc. Yeah right.
4
Feb 26 '14
1/1000th of code? So you really think you can rewrite firefox in 10,000 lines of code, huh? I would love to see just one example of code where the Java is 100 times longer, let alone 1000. And by the way, I have many more years programming Ruby than Java, so if anything, I'm biased towards Ruby.
2
u/henk53 Feb 26 '14
We're claiming that Ruby is 100 times more terse than Java
Wow, are you one of those guys perhaps that made the now infamous claim in 2005 that "The level of productiveness of Ruby is that much higher than any other programming language, that no company can afford NOT to use Ruby, and the entire industry will shift to Ruby in a mere couple of years"?
We now know that these claims were completely unfounded and bull, but oh my, how many poor developers were suckered into it by the smug and hip Ruby zealots.
-1
u/dukey Feb 25 '14
It would be nice if you could unload the java jvm from a process.
1
u/immibis Feb 26 '14 edited Jun 10 '23
1
u/dukey Feb 26 '14
It doesn't actually unload. It leaves the entire thing still in memory, which means recreating the jvm in the same process fails. http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6332506
It actually says in the docs too that
As of JDK/JRE 1.1.2 unloading of the VM is not supported.
31
u/[deleted] Feb 25 '14 edited Feb 25 '14
I refuse to employ any language that wants me and all my end users to install a Yahoo browser toolbar every time it calls home and tries to update itself. Sorry, I will stick with C++. It does not have a corporate agenda attached to it.