- 50 line comments containing type annotations in a strictly typed language and HTML
- 80 column limit
- single character variable names
- variable declarations inside loops
yeah ...
Edit: I like that people downvote without having counter arguments.
- type annotations + HTML in comments - it is called javadoc
- 80 column limit - lowest common denominator for most people, also historically part of Sun code conventions for Java - http://www.oracle.com/technetwork/java/javase/documentation/...
- single character variable names - who cares, a symbol is a symbol
- variable declarations inside loops - more readable, no chance of referencing stale value outside of scope, and HotSpot will probably recompile anyhow
I don't love the variable declarations inside loops and hadn't noticed them, but even if I did, I don't have an opinion about them. Maybe they aren't good for performance? If so, well, then you have a point but I can't say. I'm not a Java expert, I'm not even using it very often.
My first point in the comment you replied was "don't dismiss it just because it's a language you don't like, it actually looks beautiful" and you are arguing that (correct me if I'm wrong) it's not beautiful at all. I wouldn't down-vote you, but it's obvious that we differ on taste. Maybe I should have said that "the beauty of the referenced code is very hard to match if you ignore your bias against a language and appreciate the stylistic choices" as you would probably also agree that it is at least very, very coherent.
If I'm a new contributor and just browsing the code I want to be able to stop on a line an understand what it roughly does just by reading that line without having to replay the whole execution stack in my head as required context.
I agree that the other issues are stylistic and are less important.
The algorithm might be beautiful but it's debatable for the implementation.
Depends on the standards. A lot of language standards say to declare vars near where you use them. Does make syntactical analysis easier. See scoping and namespace rules.
What's wrong with variable declarations in loops?
Other languages with other standards, yep, nasty.
Language wars are tiring, pedantic and really not part of this discussion on schedulers.
Or just standards at all.
I'm sorry but when you read lines like this:
> if ((i = (r - j) & m) >= 0 && i < n && (q = ws[i]) != null) {}
with 6 single character long variable names and 1 two character long variable name, there is something to be said about code quality.
And this is a rule that is true across programming languages.
This is a typical example of written once / never modified or single maintainer code and it's a bad practice, especially for open source projects.
If you really think something is wrong with it, post ideas for longer names that will clarify and not substantially impact density. I would probably conventionally use "n0" and "n1" instead of "m" and "n" to represent "n-1", "n" - but the usage he has is consistent throughout the file, which is more than I can say of my stuff sometimes.
Having used both Java and Go, the two seem almost indistinguishable to me (well, they differ in many details, but none that matters much, and their more pronounced differences have nothing to do with linguistic features); Java is more or less Go with generics and exceptions.
Those four things alone are pretty big differences, and then there are more intangible yet important differences like stdlib and culture, and implicit interfaces. They are definitely in the same family, but not as closely related as you imply - they are not indistinguishable. I'd say the similarities are more in unimportant stuff like syntax, some of the differences are important.
All that said, I have a lot of criticism for Go as well, especially as a language. I just can't see Java being on par with Go, even with generics. Of course Go has more than a decade of hindsight that Java didn't have (or at least Java was in too deep by then to make the requisite changes).
Basically applies to most mature widely used languages that have evolved by adding features. In many software projects, the bias is on the side of adding too many features and not accounting for the costs, to the point where someone feels a bit of pain and complains. In Go, the bias is in not having enough, to the point where someone feels a bit of pain and complains.
I'd bet that more language designers are going to opt for the 2nd strategy as we go forward in the 21st century.
In any event, even regardless of how big you think the linguistic differences are, Java and Go are far too similar to like one and so strongly despise the other (although you could certainly prefer one over the other). We're not talking Go vs. Haskell, or Python vs. C here.
- functions: Java does not have functions, only methods
- closures: Not sure of the latest state, but until very recently, Java had no closures. Closures are a huge and important element of programming.
- single file executables: make your program easy to deploy, without shipping a JVM, setting up a classpath etc.
- value types: have control to which structures you want to refer by pointer and which should be treated as a value
- goroutines+channels: a far better approach to parallel programming, a goroutine is much more light-weight than a Java thread
- no generics the Java style: eventually Go needs generics, but not in the way Java implemented them.
- no frameworks: possibly not a strict language related issue, but Java grew monstrous frameworks, the Go community has been stay away from them so far.
In my opinion, Java is a great language that has was ruined by enterprise adoption. SOAP, JavaBeans etc, set this precedent of crazy over-engineered solutions in Java and it has never really recovered.
Go seems to attract C and Python programmers that prefer simpler interfaces and doing more with less. It is just a different culture, though I would agree from a language perspective they are very similar.
Which is great, choices are good and you can pick the culture you prefer, but you can only say the languages are similar if you ignore this huge chasm in their cultures.