Link Details

Link 60102 thumbnail
User 264051 avatar

By bspies
via ajaxonomy.com
Published: Jan 06 2008 / 20:06

A follow-up to the Java Enum Tricks article that gives an in-depth example of an enumeration of Java application servers (Container).
  • 16
  • 1
  • 3255
  • 1379

Comments

Add your comment
User 236137 avatar

dzonelurker replied ago:

0 votes Vote down Vote up Reply

Why are people using those silly '@Override' annotations in their programs?

User 107114 avatar

daniel replied ago:

3 votes Vote down Vote up Reply

Because it provides compile-time assurance that you actually *are* overriding a method from a superclass. Thus you avoid scenarios where you remembered the method signature incorrectly and accidentally overloaded the method rather than overriding. Additionally, you get some assurance that you can avoid behavior changes in the case that the superclass method signature changes out from underneath you (like when the part-time intern refactors your hierarchy without telling anyone).

User 261679 avatar

Vikstar replied ago:

0 votes Vote down Vote up Reply

The first example is easily taken care of with a good IDE showing you when a method is overloaded or overridden, eliminating the need for @Overide in that case. Although usefull in the second case, the @Override annotation remains, to my opinion, a necessary scar on the face of java code.

User 256244 avatar

amalter replied ago:

2 votes Vote down Vote up Reply

Man, you should spend less time lurking at dzone and more time coding

User 204561 avatar

Ignacio Coloma replied ago:

1 votes Vote down Vote up Reply

If you ever try a refactor hell that affects +100 classes, you will find @Override useful.

After that, you even feel good when you see it around.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.