Re^2: Using constant to override (abstract) methods.by klekker (Pilgrim)
|on Mar 28, 2011 at 10:27 UTC||Need Help??|
So you are asking 'Why?!'? That's why I like reading PM! :)
The example lacks some documentation that is included in the 'real' code, so I'm confident that my colleagues can deal with the code.
But more important and interessting: 'why'?
First of all: I don't claim that this is the best or most clever solution.
The motivation for this was, that we have a bunch of small classes with immutable values (like for example: error-classes).
You've got FileError, DatabaseError, FooError... all these errors share an errorCode, an errorText, an errorDescription and also a static list of errorFields which the error could affect.
So I decided to create an interface Error for these errors so that every error-class (which are using constants so far) really implements all constants.