Constants in Interfaces or Classes
I am wondering what people think on where Constants should end up. I found this thread http://www.theserverside.com/discussions/thread.tss?thread_id=19221 and basically ended up answering my own question, but I am not 100% sure if it is valid.
I personally prefer constants in interfaces because its less typing to do. However, if you have non-trivial constants you would generally need a class I think in order to have the static { } initializer. So I would end up using constants in classes just to keep things consistent even if I had to do "public static final" for every single constant. I wish there was a simpler way of doing this without using a code generator which I defined in my blog.
I personally prefer constants in interfaces because its less typing to do. However, if you have non-trivial constants you would generally need a class I think in order to have the static { } initializer. So I would end up using constants in classes just to keep things consistent even if I had to do "public static final" for every single constant. I wish there was a simpler way of doing this without using a code generator which I defined in my blog.
