lombok advantages and disadvantages

advantage:

  1. Annotations can form automatically generated constructor, getter / setter, equals, hashcode, toString other methods to improve the efficiency of development of certain
  2. Let code becomes simple, not too much to pay attention to the appropriate method
  3. When making changes properties, but also simplifies maintenance of these properties generated getter / setter methods

Disadvantages:

  1. It does not support multiple overloaded constructor parameters
  2. While eliminating the need to manually create trouble getter / setter methods, but greatly reduces the readability and integrity of the source code, reducing the comfort of reading the source code

 

 

Lombok Summary: 

Although Lombok has many advantages, but more similar to one kind Lombok IDE plug, projects need to rely on a corresponding jar package. Lombok dependent jar package because to use it in the comments compiled, why it is similar to plug-in? Because during use, eclipse or IntelliJ IDEA will need to install the plug-in, change the byte code generation, that is, it is changed to the java grammatical variations by operating the AST (Abstract Syntax Tree) when the compiler. Unlike spring dependency injection, or as is characteristic of an ORM mybatis runtime, but the characteristics of compile time. I personally feel most uncomfortable place to be is dependent on plug-ins! Because Lombok just eliminating some trouble artificially generated code, but there are shortcuts to assist the IDE generates getter / setter methods, it is also very convenient.

God know there was a large number of published views of Lombok on peace:

This is a vulgar plug, not recommended. JAVA development today, the endless variety of plug-ins, how to identify the pros and cons of various plug-ins? From the architecture to optimize your design, can improve the performance of the application program, 
to achieve highly scalable package ..., lombok like this, like this plug-in, the plug has not only changed how you write source code In fact, less to the code you write up how?
If JAVA family full of such things everywhere, it was just a lump of feces dressed in metallic colors, sooner or later it will be replaced by other languages.

Although the word processor but do not rough rough, imagine a project like this is very much similar to the plug Lombok, personally I feel really greatly reduces the comfort of reading the source code.

Although not very recommended to write in property getter / setter some business code, but in actual combat in multi-year projects, sometimes by giving getter / setter plus a little bit of business code, the code can greatly simplify certain business scenarios. The so-called trade-offs, perhaps this time to give up certain norms, get great convenience.

I am very convinced that a philosophy, any programming language or plug-ins are only just a tool, even if another powerful tool also lies with the person, like millet plus rifles still win the same reason aircraft artillery. Combined with specific business scenarios and the actual situation of the project without the blind pursuit of technology on the tall, fit is crucial.

Lombok has its unique advantages and disadvantages it shunned, familiar with its advantages and disadvantages, flexible use in actual combat is king.

 

 

 

Original: https: //www.cnblogs.com/heyonggang/p/8638374.html

 

Disclaimer: This blog is a personal learning, as with other similar works, is purely coincidental, reproduced, please indicate the source! 

Guess you like

Origin www.cnblogs.com/zhihuifan10/p/11325612.html