Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Using constant to override (abstract) methods.

by klekker (Pilgrim)
on Mar 28, 2011 at 10:27 UTC ( #895878=note: print w/replies, xml ) Need Help??


in reply to Re: Using constant to override (abstract) methods.
in thread Using constant to override (abstract) methods.

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.

k
  • Comment on Re^2: Using constant to override (abstract) methods.

Replies are listed 'Best First'.
Re^3: Using constant to override (abstract) methods.
by chromatic (Archbishop) on Mar 29, 2011 at 05:10 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://895878]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2020-10-29 23:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (274 votes). Check out past polls.

    Notices?