33 ms·
No, actually, Java is a really bad language. It has a very complicated type system, but doesn't even allow you to express things like function composition or g
by cia_plant 13y ago
No, actually, Java is a really bad language.
It has a very complicated type system, but doesn't even allow you to express things like function composition or generic sums at the language level.
Its syntax is stunningly verbose (e.g., no map literals; only now adding lambda literals; no type synonyms; no operator overloading).
There is no macro system or method_missing or any other way of really extending the language, except the ugly, unsafe reflection system ... so now all the libraries (Spring, Hibernate, etc.), use annotations and reflection to modify object behavior at runtime.
- stusmall 13y agoWhat is complex about the type system?
- bronxbomber92 13y agoI'm guessing he's referring to wildcards (http://cseweb.ucsd.edu/~atl017/papers/pldi11.pdf http://cseweb.ucsd.edu/~atl017/papers/pldi11.pdf) and the fact that the type system allows this (which isn't really a complexity, but rather a deficiency): Object[] foo = new String[1]; foo[0] = new Integer(4); // exception thrown here instead of a compile error.
- mercurial 13y ago> It has a very complicated type system, but doesn't even allow you to express things like function composition or generic sums at the language level. Yeah, sure, it doesn't have Haskell's . or algebraic datatypes, just like lots of other languages. I'm not sure what's complicated about the Java type system, but I suspect you're trying to say you don't like subtyping. Moving on... > Its syntax is stunningly verbose (e.g., no map literals; only now adding lambda literals; no type synonyms; no operator overloading). No map literals, but Guava has leveraged generics in a brilliant way to reduce the duplicate declaration of types. Also, it brings a little bit of functional-style goodness with transform/filter. It turns even JDK 6 into something you can be productive with. I'm not sure the lack of type synonyms is really an issue, the type signatures are rarely complex enough that you need to obfuscate them. On the other hand, I'd give somebody else's right arm for an equivalent to newtype and deriving. > There is no macro system or method_missing or any other way of really extending the language, except the ugly, unsafe reflection system ... so now all the libraries (Spring, Hibernate, etc.), use annotations and reflection to modify object behavior at runtime. Not to forget proxy objects and interceptors. But yes, Java could definitely use a macro system. But you're missing the elephant in the room, the existence of null. The bane of every Java programmer, dreading NPEs at each function call.
- meddlepal 13y agoChecked Exceptions and null. I write a lot of Java and I generally enjoy the language, but those two things; if Oracle could fix those somehow I would be extremely pleased. I'm so tired of writing null checks and I hope Optional<T> is not the final answer since it too can be a null due to programmer error. I am really worried about Optional getting abused in Java 8... Actually, I waffle on checked exceptions; it seems every 8 months or so I have a different opinion of them. Right now they suck.
- stusmall 13y agoI'm the same way with checked exceptions. Right now I am in the pro-camp... but just give me a little bit. I am about to start a greenfield jvm project so I think I will be anti soon... but once its mature and I'm in bug fix mode I'll be heading back to the pro-camp.
- yawz 13y ago> Checked Exceptions and null I hear you.
- CodeMage 13y ago> Checked Exceptions and null. Let's not forget about type-erasure generics. And the existence of arrays. And the fact that people still use arrays.
- zeroDivisible 13y agoExactly - checked exceptions is more of an policy / code style decision, null and NPE - roughly the same and in the end your spider sense just knows where to expect it. But type-erasure of generics - that's the decision with which we will need to live till the end of time. - no multiple implementation of same generic interface - http://stackoverflow.com/questions/2723397/java-generics-what-is-pecs - small performance hits.. - casts - a lot more but I'm just sleepy right now. I use and like Java, I love the backwards compatibility which it has - but there are times when crust can be removed with scalpel - and if not, you will need an jackhammer later.
- peterashford 13y agoJava is not a bad language. It was written as a reaction to C++ - a simpler, more consistent systems programming language. In that regard it has been wildly successful. It doesn't really look like a dynamically typed scripting language because it was never trying to be one. You pick a bunch of language flavour / syntactic sugar and say that Java is bad because it doesn't have those. Personally I like it because it doesn't have things like operator overloading. These are you own preferences, not inherent flaws with the language.
- democracy 13y ago... and also this makes Java a great choice for large distributed teams of programmers of different levels of expertise.
- tsotha 13y agoThis. I realize the perl people love to have twenty different ways to do everything, but when I'm trying to get maintainable code out of an average team of programmers I don't mind the verbosity and I don't mind the lack of cryptic language features. The original java architects took operator overloading and the macro preprocessor out for a reason - you can end up with orders-of-magnitude more ugly code if those features are abused.
- peterashford 13y agoI was a C++ programmer for a very long time (and a C programmer for a long time prior to that). The abuses of 'helpful' features like operator overloading that I saw in C++ code would be enough to make a grown man cry.
- bane 13y ago> Its syntax is stunningly verbose (e.g., no map literals; only now adding lambda literals; no type synonyms; no operator overloading). I can see both side of this. My favorite language to work in is Perl, which is loaded with all kinds of little context sensitive literals. But Java "the language" is pretty quick to pick up and get working with if you're already familiar with another Algol family language, and you can usually read other people's code without too much fuss because the language doesn't support all sorts of ways of writing something. But on the other hand, you do end up with lots of lines to do something that should be relatively few lines if a more context specific syntax was supported. For example, the last time I worked with Java, code was littered with a half dozen lines of Iterator mess every time you wanted to go through some collection, the new for syntax is very very nice...but there's still little hard corners it's not that well supported in, like maps, because the underlying structure of the map means I have to build some temporary object to handle an item on the map in the loop...even though the map collection I'm using is in the standard library and should be part of the language via some syntactic sugar. I'm still stunned that operator overloading isn't supported, I have a few use-cases already where that would be very helpful.
- mahyarm 13y agoGo work with C++, and you'll pine for Java.
- jussij 13y agoAnd go work with C# and you'll pine for nothing. I've used all three and after a few years of C#, the other two are just a distant memory.
- kyrra 13y agoWhich is heavily windows focused, which is non-starter for a lot of devs. Sure there is Mono, but it does not have nearly the man power behind it that .Net and Java have.
- WildUtah 13y agoAnd go work with C# and you'll pine for nothing. Except any worthwhile platform where you're not a second class citizen.
- dragonwriter 13y ago> And go work with C# and you'll pine for nothing. If that was true, F# wouldn't have happened. (Nor IronRuby/IronPython). Even people who like the .NET platform often pine for something better for the task at hand than C#.
- edwinnathaniel 13y agoI did, but then javaagent and JMX pulled me back because hooking to runtime in .net sucks.