What is the point of this article? To vent about how much they dislike Java? It's clearly not to educate, as the least they could do is try researching how to do repeating annotations in JDK 8: http://softwarecave.org/2014/05/20/repeating-annotations-in-... And it's clear from reading the annotation documentation that null is not a valid value. It might be surprising to some developers, but it was a conscious decisio…
Java Annotations
11–20 of 23 posts
Re: Java Annotations
#12What is the point of this article? To vent about how much they dislike Java? It's clearly not to educate, as the least they could do is try researching how to do repeating annotations in JDK 8: http://softwarecave.org/2014/05/20/repeating-annotations-in-... And it's clear from reading the annotation documentation that null is not a valid value. It might be surprising to some developers, but it was a conscious decisio…
Re: Java Annotations
#13Comparing C# and Java is so last decade. I don't use Java because of the language, but because of its enormous toolset and awesome community. If there is something I can't do well with Java, then I have Groovy. I will most likely waste time trying to implement the same thing with C#. In fact I would probably just use Python or C instead.
This! I really don't know why those comparing languages fail to recognize that a language's success has got much to do with the "ecosystem" as well; tool-set, libraries and so on.
I've used build/release management/dep management tools from/like go, python, ruby, node, erlang, make, autotools and cmake and I've never before had to read a manual to tweak an existing setup.
Go is probably my favourite ecosystem because everything is very simple. I suspect Rust will be good as well.
Re: Java Annotations
#14Annotation in itself is not bad IMO. Used carefully as language-level extension mechanism like it is being used by Swift, it's useful.
What I disliked when annotation was first introduced is User-defined Annotation because the feature in-effect turns code into magic.
Re: Java Annotations
#15Comparing C# and Java is so last decade. I don't use Java because of the language, but because of its enormous toolset and awesome community. If there is something I can't do well with Java, then I have Groovy. I will most likely waste time trying to implement the same thing with C#. In fact I would probably just use Python or C instead.
Fortunately not everyone in the Java community is happy with the way things are. Indeed, Java 8 fixes some of the issues mentioned here, like repeating an annotation. Obviously this wasn't some brilliant insight developed in a vacuum, people looked at C# and thought "Neat, I want that!", and now Java is a better language because of it.
As engineers we should not settle for the way things are. One day we'll hopefully have Reified Generics, maybe properties and other obviously good ideas, and no thanks to the people who are happy with Java as it is now. "People who say it cannot be done should not interrupt those who are doing it" comes to mind.
Re: Java Annotations
#16Why does the author seem surprised when his code doesn't compile after adding a non-optional parameter? It's arguable whether parameters should be optional by default or mandatory by default. Not really knowing much about c# I guess anything besides primitives will be `null`, which doesn't seem like you gain much.
I'm not sure I have ever seen annotation used like in this `whenType` example. Besides that the whole approach looks suspiciously complex (why not just create `@DefaultPriority` which you can add to your type?), annotations are supposed to be simple meta data and you shouldn't be trying to implement some kind of logic with them. Any logic like this should be done when processing the annotation in my opinion.
Java annotations sure are limited and it's does seem kind of weird that you can't use null as default value. But I never encountered any real problems that couldn't be handled by inspecting annotations using reflections or annotation processors.
Re: Java Annotations
#17Comparing Java and .NET is unfair. Java was created in the 90's. .NET is way younger than that. .NET was created with Java in mind, and of course it's a better language. Each language has its strengths.
.NET was originally supposed to be an embrace... extend... extinguish strategy by Microsoft on Java wasn't it? I seem to remember when .NET first came out people saying that you could almost copy and paste C# and Java code back and forth.
Re: Java Annotations
#18Comparing Java and .NET is unfair. Java was created in the 90's. .NET is way younger than that. .NET was created with Java in mind, and of course it's a better language. Each language has its strengths.
Re: Java Annotations
#19I just don't see the need for this kind of negativity. If a language wasn't designed for a certain way of using annotations (or any feature), maybe another method should be tried to get similar results. It may not be ideal and may not fit the paradigms of what you're used to, but it's a completely different language for heaven's sake.
It's like asking why a Honda Accord isn't faster than a Lamborghini... But at least the Accord holds 4 people and has useable trunk space. They're built for different needs, nobody expects an accord to race well, and nobody expects a lambo to be good for soccer moms and off-roading. So why the hate?
Re: Java Annotations
#20What is the point of this article? To vent about how much they dislike Java? It's clearly not to educate, as the least they could do is try researching how to do repeating annotations in JDK 8: http://softwarecave.org/2014/05/20/repeating-annotations-in-... And it's clear from reading the annotation documentation that null is not a valid value. It might be surprising to some developers, but it was a conscious decisio…
The article was published 5 days before the release of Java 8 - at least if my quick googling was correct. That might explain why it doesn't mention repeating annotations as a solution.
[1] http://openjdk.java.net/jeps/120
[2] http://blog.functr.com/2012/09/java-8-features-discover-repe...