This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Constant Data Manager pattern

 
Mihai Lihatchi
Ranch Hand
Posts: 138
Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.
Just wanted to know whether this pattern has some major drawbacks in large J2EE applications.
Currently I am looking at reading all the constant data from either a properties file or the database.
For now the constant data is stored in static fields in all the classes from my application.
The only drawback is that I have to keep using the ConstantDataManager everywhere in the application and that the static fields do not make as much sense as when stored in the corresponding classes .

Do you have experience with implementing this pattern ? It looks to me as I have a good solution with this pattern.
PS: I am working with Spring & Hibernate if this helps.


Mihai
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What problem are you trying to solve by using property files or a database?
 
Mihai Lihatchi
Ranch Hand
Posts: 138
Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is a matter of data that changes every 2 -3 years and can't be hardcoded in the application and yet it is described a lot of classes from the domain (public static and final).
 
Mihai Lihatchi
Ranch Hand
Posts: 138
Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like it is a bad idea after all.

Thanks for your help Ilja.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is a bad idea, and why? And how did I help?
 
Mihai Lihatchi
Ranch Hand
Posts: 138
Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
by making me think..
It is a bad idea because having the static data in one place may save modifications but it does not make sense anymore for other classes developers from the team .


Mihai
[ November 15, 2006: Message edited by: Mihai Lihatchi ]
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mihai Lihatchi:
by making me think..





It is a bad idea because having the static data in one place may save modifications but it does not make sense anymore for other classes developers from the team .


Well, but having to change the code everytime a value changes is a bad idea, too, especially when we know that it *will* change at regular intervals - isn't it?

Is there a solution that would solve both problems?
 
Mihai Lihatchi
Ranch Hand
Posts: 138
Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know. However at this point can't afford to take these chances .. I am not allowed to take such a decision.
A compromise sounds as the best solution. (that is develop repositories for constant data per modules/sections of the application).
Anyhow for now just canceled any changes due to risks involved.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic