Home > database >  How elegant writing code
How elegant writing code

Time:10-07

One, use the @ Override annotations, @ Override should be one of the most common in the Java code - an annotation, for all inherited the superclass method, should use the annotation logo, with the class in order to facilitate their own method to distinguish, but also conducive to go wrong, the problem exposed to compile time is not running, using the same annotation methods like a - don't need to write a comment, because it is the parent class, so you need to consistent with the superclass method function, natural methods that would be - cause, do not need to write a again, if you find that many of your mark @ Override method must write alone -- a comment to illustrate the time to consider whether there is something wrong with the code,
Two, use the @ Deprecated annotations, the annotations may contact is not much, many people said the annotations are annotated method is Deprecated, mark the use of the annotation method in use in most IDE will be displayed on the method call a cross a dash out method, said, see the annotations in many frameworks, this is because the frame need to be considered in the process of upgrading, to most of the users of the framework, maintain backwards compatibility, so when API change with new API will not only ensure the normal use, as well as to guarantee the normal work of the old API, but if the frame users still use the old API? Then you can increase the annotations on the old API method, tells the API framework users is an expiration will soon be deprecated API, is not recommended, if you need to use the new API, please use the alternative at this time most of the users of the framework will choose to use a new alternative API,
Three, connected to an annotation, if use the @ Deprecated annotations, so how do you tell others alternative API? Or perhaps people who are used in the method statement directly write the name of the alternative, but if you have a careful look at the practice of various framework you will find that their like you is not the same as you, their method seems to be - a link to click to jump to another API methods., and you write directly the method name is according to the method name, one by one to find, low efficiency, if the method name change, so this place could be omitted, so the omissions place is already expired, so how did those frameworks do directly click on methods that can jump to another way? Actually very simple, need only in writing the method that use the writing:

CodePudding user response:

Master writing code is generally rarely comment now, because the code is already can well reflect the author intention...

CodePudding user response:

Good is very helpful

CodePudding user response:

Abut it's worth a look too useful thanks for sharing

CodePudding user response:

Very useful help much hope there's more to share

CodePudding user response:

Very nice, worth sharing, thanks to the building

CodePudding user response:

Thanks for so that I can just write something nice HTML

CodePudding user response:

Thanks for sharing, there is a big help to me

CodePudding user response:

Good mutual

CodePudding user response:

Wow, great, great help to me

CodePudding user response:

Very good well worth learning, is very helpful to us

CodePudding user response:

Good, is really a great help to me

CodePudding user response:

The building Lord, sharing good oh, a great help

CodePudding user response:

The original poster is great helpful to electric business personnel

CodePudding user response:

You this is very good, every time I knocked code is not good, thank you for your sharing, next time I have a tip

CodePudding user response:

Thanks, blogger, there is a big help to me

CodePudding user response:

Very useful, thank you for your sharing

CodePudding user response:

Hee hee, the original code is how good thank you give me the opportunity to learn,

CodePudding user response:

Thank you for your sharing, for us to learn some of the code base of electricity are helpful

CodePudding user response:

The building Lord come on together! To learn me, you to share

CodePudding user response:

Is helpful, educated, I hope more tutorials posted later

CodePudding user response:

The building Lord, sharing good oh, a great help

CodePudding user response:

Very good advice, you will be good

CodePudding user response:

H1105
reference 3 floor response:
abut worth a look too useful thanks for sharing

Very well, this professional large leaves

CodePudding user response:

refer to the original poster wudy924 response:
a, use the @ Override annotations, @ Override should be one of the most common in the Java code - an annotation, for all inherited the superclass method, should use the annotation logo, with the class in order to facilitate their own method to distinguish, but also conducive to go wrong, the problem exposed to compile time is not running, using the same annotation methods like a - don't need to write a comment, because it is from the parent class, so you need to consistent with the superclass method function, natural methods that would be - cause, do not need to write a again, if you find that many of your mark @ Override method must write alone -- a comment to illustrate the time to consider whether there is something wrong with the code,
Two, use the @ Deprecated annotations, the annotations may contact is not much, many people said the annotations are annotated method is Deprecated, mark the use of the annotation method in use in most IDE will be displayed on the method call a cross a dash out method, said, see the annotations in many frameworks, this is because the frame need to be considered in the process of upgrading, to most of the users of the framework, maintain backwards compatibility, so when API change with new API will not only ensure the normal use, as well as to guarantee the normal work of the old API, but if the frame users still use the old API? Then you can increase the annotations on the old API method, tells the API framework users is an expiration will soon be deprecated API, is not recommended, if you need to use the new API, please use the alternative at this time most of the users of the framework will choose to use a new alternative API,
Three, connected to an annotation, if use the @ Deprecated annotations, so how do you tell others alternative API? Or perhaps people who are used in the method statement directly write the name of the alternative, but if you have a careful look at the practice of various framework you will find that their like you is not the same as you, their method seems to be - a link to click to jump to another API methods., and you write directly the method name is according to the method name, one by one to find, low efficiency, if the method name change, so this place could be omitted, so the omissions place is already expired, so how did those frameworks do directly click on methods that can jump to another way? Actually very simple, need only in writing the method that use the writing:

Well, for those of us who are learning the professional is very useful, improve the efficiency

CodePudding user response:

refer to the original poster wudy924 response:
a, use the @ Override annotations, @ Override should be one of the most common in the Java code - an annotation, for all inherited the superclass method, should use the annotation logo, with the class in order to facilitate their own method to distinguish, but also conducive to go wrong, the problem exposed to compile time is not running, using the same annotation methods like a - don't need to write a comment, because it is from the parent class, so you need to consistent with the superclass method function, natural methods that would be - cause, do not need to write a again, if you find that many of your mark @ Override method must write alone -- a comment to illustrate the time to consider whether there is something wrong with the code,
Two, use the @ Deprecated annotations, the annotations may contact is not much, many people said the annotations are annotated method is Deprecated, mark the use of the annotation method in use in most IDE will be displayed on the method call a cross a dash out method, said, see the annotations in many frameworks, this is because the frame need to be considered in the process of upgrading, to most of the users of the framework, maintain backwards compatibility, so when API change with new API will not only ensure the normal use, as well as to guarantee the normal work of the old API, but if the frame users still use the old API? Then you can increase the annotations on the old API method, tells the API framework users is an expiration will soon be deprecated API, is not recommended, if you need to use the new API, please use the alternative at this time most of the users of the framework will choose to use a new alternative API,
Three, connected to an annotation, if use the @ Deprecated annotations, so how do you tell others alternative API? Or perhaps people who are used in the method statement directly write the name of the alternative, but if you have a careful look at the practice of various framework you will find that their like you is not the same as you, their method seems to be - a link to click to jump to another API methods., and you write directly the method name is according to the method name, one by one to find, low efficiency, if the method name change, so this place could be omitted, so the omissions place is already expired, so how did those frameworks do directly click on methods that can jump to another way? Actually very simple, need only in writing the method that use the writing:

Very good very good very good very good very good

CodePudding user response:

The building Lord, share useful oh, a great help

CodePudding user response:

The building Lord, share useful oh, a great help
  • Related