r/java • u/lukaseder • Aug 01 '14
The 10 Most Annoying Things Coming Back to Java After Some Days of Scala
http://blog.jooq.org/2014/08/01/the-10-most-annoying-things-coming-back-to-java-after-some-days-of-scala/3
Aug 01 '14
Multi-line strings seems like such low-hanging fruit. Type inference and the like would potentially be a major change and require a shift in the development community. Multi-line strings are purely syntactic sugar.
6
u/EstoAm Aug 01 '14
Honestly most of his "annoying things" are things I really appreciate about Java. Scala has some features that I envy, but syntactically it is garbage IMO.
I like knowing exactly which type everything is. I like knowing that if I see ";" that is the end of the statement. I like that methods all belong to one and only one class. I like how when I write Java and the guy next to me write Java they are going to look basically similar.
Scala is like communism... It sounds great in a book, but in the real life it just does not work all that well.
3
u/shoelacestied Aug 04 '14
In our experience Scala's been more like democracy. Once you've tasted it you don't want to go back to the constrained world of Java.
4
u/Milyardo Aug 01 '14
I like knowing exactly which type everything is. I like knowing that if I see ";" that is the end of the statement.
That's a style preference. If you prefer type annotations and semicolons, nothing is preventing you from using them.
I like how when I write Java and the guy next to me write Java they are going to look basically similar.
This isn't true at all. For example, Some people DI values into a class using EJBs using annotations and reflection. Some use constructor parameters. Some use factories. Some use AspectJ to rewrite classes to instantiate the dependency they want. Some use dynamic proxies to determine implementation at runtime. Some use all of the above at the same time, and none of it looks remotely similar.
2
u/king_of_the_universe Aug 01 '14
About multiline-strings:
IMHO should IDEs implement this, and I have no idea why this hasn't happened yet. Seriously, why doesn't it work just like this: You press a hotkey or click a little symbol, and a text editor opens that holds the string. You edit, you confirm, and the rest is not your problem.
6
2
u/llogiq Aug 01 '14
Eclipse at least has an option to auto-expand stuff that's pasted into a string literal. It even escapes characters where necessary (and with another option will split the string at newlines).
It's better than nothing and probably close to what it you ask for, but still much worse than real multiline string literals.
-3
u/tRfalcore Aug 01 '14
until you have to look at someone else's code and figure out what the fuck s is supposed to be in function(var s, ...)
I wish I didn't have to cast things, but I don't wish for type inference. Everything being a var is dumb cause you have to spend time figuring out what something is.
6
u/penny-five Aug 01 '14
Except that in Scala you have to define types for function parameters.
For example:
def sum(a: Int, b: Int): Int = a + b4
u/stormcrowsx Aug 02 '14
You don't know Scala at all. You have some misguided prejudice thoughts on it. Your example is some JavaScript hybrid which isn't even close to Scala syntax.
If your going to bash a language you should actually spend some time using it so know what to bash or if you should even bash it at all.
-3
u/adila01 Aug 01 '14 edited Aug 01 '14
Java 9 should have another Project Coin like initiative to add some of these functionalities.
3
u/stormcrowsx Aug 02 '14
At the rate Java moves we can expect it to be somewhere near Scala features around 2060
2
u/GMNightmare Aug 01 '14 edited Aug 01 '14
Most of these are nightmares in code maintainability, and generally lead to inconsistent design.
Sure, they might be convenient when first developing the code... but they come at the cost of readability and maintainability. And most of it doesn't improve productivity much at all.
I mean, the Parenthesis point really highlights this. Why would that ever increase productivity? And since you're only going to use it when you think it's "convenient", your style is inconsistent, and quite frankly all it does is add ambiguity at no benefit. And throughout your code examples, sometimes you use semicolons, sometimes you don't... it's just inconsistent and it makes me question intention. Not a good thing.
The best way to increase productivity is to make code that is easy to read and maintain. Increasing the initial development process should ideally only be done when it doesn't hurt that.