Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

and what do you think about Constants class?

 
Pavlo Rybakov
Greenhorn
Posts: 24
  • 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: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • 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)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic