Drawbacks with xml based configuration:
1. verbosed.
2. lengthy tags, in specific order difficult to memorize and makes it complex to work.
3. xml is not an java language, so needs more learning curve to understand it.
4. doesn't support inter-mediate compilation like java, so the only way to identify the errors in xml configuration is at runtime thus makes it hard to debug the errors and fix them so kills lot of developers time.
5. no powerful ide supporting xml.
6. since the configuration is placed externally in a xml file, the developer has to switch between java and xml to understand the information about the javacode.
considering all xml doesnt support rapid application development.
Advantages of annotations:
1. annotations are short in nature, at max spans an word. easy to memorize and quick to write
2. annotations are java special interfaces types, so dont need to learn a new language something like xml to work with annotations, since every java developer is familiar with java.
3. annotations are written directly aspart of the sourcecode of the java classes, so those are compiled along with sourcecode and produces compile-time errors if there are any mis-configuration issues are there .
4. every java ide supports writing annotations.
5. all the information pertaining to a class along with configuration is available within the sourcecode directly, so it is easy to understand the information about a class.
annotations support RAPID application development.
Drawbacks with annotations:1. since the configuration is written directly within the source code, a change in configuration requires modification of source code, that enforces recompilation, repackaging, redeployment and restart the servers to have the changes effected.
2. annotations cannot be written for the classes who doesnt have sourcecode.
3. holistic configuration information about all the components and their configuration cannot be derived while using annotations
Advantages of xml:
1. easy to change without modifying the sourcecode. and the changes would gets effected easily.
2. we can apply XML on the classes for both who has sourcecode and no sourcecode.
3. the complete configuration information of the entire application can be derived at one-shot by looking at once single central xml configuration file.
From the above we can understand each of them has their own advantages and dis-advantages, which one should be preferred and used when?
Comments
Post a Comment