0

I was arguing with somebody whether it is okay to put constants into an interface. Some languages support that, while others don't. I like the idea to put some non-configurable, but not necessarily implementation related constants to interfaces, so I don't have to inject them by instantiation or care too much about them. Be aware that I am not talking about totally constant interfaces, which is a known anti-pattern. I found that somebody likes this feature too. Can you tell me more about the preconditions and/or constraints of this feature, or just when do you think it is a good practice to use them?

Community
  • 1
  • 1
inf3rno
  • 24,976
  • 11
  • 115
  • 197
  • This question is better for another Stack Exchange Q&A Site. – Grzegorz Górkiewicz Feb 16 '17 at 13:47
  • @GrzegorzGórkiewicz I don't think so. I mean there are many theoretical/best practice problems discussed here too. So I think this question is okay on either this site or on a few other stack exchange sites too, but I decided to put it here, because this site has the most viewers and I think this is an important question. For example if I'd add a short java example code and the java tag I guess you would not have any problem with it... – inf3rno Feb 16 '17 at 14:00

0 Answers0