Originally posted by octavyn pittman:
One question I want to ask you though is why not use interfaces for constants? I actually like doing that and find it quite convenient, and so it would be great to hear why you find it iritating or a 'smell' of a bad coding practice.
Ths is a fairly common complaint I hear from people. Often you'll find C/C++ programmers who gripe about no global variables. Then they discover that the interface can effectively provide them with global variables, just have everyone implement the foo.bar.Constant interface, which has no methods, just variables (coulnd't be easier to use!).
What happens is the interface gets abused and overused. It becomes easiest just to throw a variable into the interface rather than have to pass it around, or worry about field access. The end result? Monolithic, proceedural like code. Instead of data hiding, everyone starts to learn everything about everyone else, and the code turns into spagetti. OO purists will argue that global variables should not be supported in a language.
There may be other reaons, too, but this is what I often hear cited.
--Mark
hershey@vaultus.com