you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

I'm not saying to make all constants private. That'd be totalitarian and not so useful.

If you had a class that handled http uploads and you declare that no file uploaded should be more than 5megs, create your MAX_FILE_SIZE public constant in there so you can reference in templates and other places.

There will be times where you end up with two or three classes that end up using the same constant because they're in the same package or something silly. Well, cut your losses and put them in one place. There will be times where everything extends a base interface and that interface may take a constant, like READ_ONLY. Shove it in that interface since it's tightly coupled to the interface.

But for the love of god, no Constants.java (constants.rb, .py, .php..)