File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

and what do you think about Constants class?

 
Pavlo Rybakov
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

What do you think about Constants class which contains all possible constants?
Why it can be a wrong way?

Thanks,
Pavlo.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I creates a centralized and global repository. Yuk! Constants, as with any other elements, should be declared close to, and at the lowest, scope where they make sense.
 
Roel De Nijs
Sheriff
Posts: 9152
76
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I created a Constants class in my gui package and also a Messages class. The first one contains a bit of useful constants, the other one contains hard-coded captions, titles, error messages,... so it will be quiet easy to adapt i18n to the application (if necessary in a future release)
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic