4 ms·
Annotations are IMHO just another and admittedly shorter representation of the same problem. You still have to learn them by heart for each lib, you don't know
by dmichulke 11y ago
Annotations are IMHO just another and admittedly shorter representation of the same problem.
You still have to learn them by heart for each lib, you don't know when they are executed and you cannot reason about them (as you could with source code).
Pretty much the same problems as XML if you ask me.
- rnovak 11y agoIf by the same problem you mean that you have to understand a library in order to use it properly, I guess so, but I don't see how that's unique to Java. I don't see any difference between having to understand annotations and having to understand libstdc++ for example, or having to learn about any particular ruby gem or node package. Every language has to deal with configuration files. Complaining because a bunch of Java developers used XML in their projects seems trite. I think XML actually has a lot of strengths (having well-defined-types and structure for one). If the complaint is that it's worse than JSON, well...I've seen way worse than XML (ASN.1 for instance), so idk...
- hepta 11y agoI'd put XML and annotations in the same class of problem because they are (mostly) not checked by the type system. For instance, you can have a REST controller that simply does not "work" because you're missing an annotation. You can easily debug this if is a place in your code where the controllers are registered, but with annotations the interactions between your code and the framework (or whatever requires annotation) are not obvious by just looking at the code.
- icedchai 11y agoNot really. Annotations are included with the code, unlike XML. They are much easier to reason about due to the immediate proximity. How do you feel about Python decorators? It's the same thing.