constants


How to manage Constants in Application


what is the best way to use Application Constants ?
What i usually do is create a separate table in database of constants and reference them as foreign key in other table.
In Java i use enum.
But how to keep a single place of authority for constants in application and what are the different ways i can do that(like table or enum).
What you described is a usual approach. You keep "constants" in the database layer and you mirror them in the application using enumerations. The only trouble is keeping them in sync. Following a strict process can help here. For example, you always update values on both levels immediately one after another, not interrupting the process for any purspose and checking in the changes immediately after it's done.
Another idea would to oly keep constants in the database. You also assign names to them. Whenever you use a constant in your application (by name) it is transparently loaded from the database. This way any change you introduce will immediately be seen by any user connecting to the database. The only error may be caused by an update happening in the middle of a transaction.

Related Links

Compiler issues: “Use of Undeclared Identifer” error with constants that still work
Instrumenting bytecode at method level
async_work_group_copy from __constant
How to use Pascal Inno Setup ExpandConstant with a string variable?
Why are constants in C-header files of libraries always defined as hexadecimal?
DirectX11 set shader constants
wampserver configuration - how to enable constants?
How do I use a constant to specify a File path in NSIS?
What ID values are constant to all Sitecore installations?
Php Notice: Use of undefined constant
fcntl.h doesn't contain all status flag constants
Choosing values for constants
How to manage Constants in Application
PHP Magic Constants
Using constants for message keys and database table names and column names
Why do we always declare constants to be powers of 2?

Categories

HOME
makefile
pug
payment-gateway
vhdl
dynamics-crm
agile
json-ld
label
phpstorm
sequelize.js
schemacrawler
spring-cloud-contract
avl-tree
subquery
constructor
hashicorp-vault
xlsx
data-synchronization
pdo
titan
r-lavaan
jogl
onsen-ui
cocoa-touch
spring-test
myob
novnc
samsung-mobile
data-cleansing
katharsis
jenkins-job-dsl
metis
receipt
recurrence-relation
openshift-enterprise
oscommerce
parse-android-sdk
polyfills
viewgroup
crop
estimation
w3-total-cache
floor
gauss
photon-controller
garrys-mod
chessboard.js
nofollow
mongoskin
picking
post-processing
asp.net-mvc-2
portfolio
web-essentials
sonarqube5.3
drf-nested-routers
datainputstream
coypu
lines-of-code
uptodate
custom-url
pl-i
scala-2.11
sid
dache
proxies
smartystreets
cppdepend
codeigniter-a3m
factors
bounds
flash-cc
document-database
.net-cf-3.5
swrl
dig
multiple-conditions
zend-lucene
vt100
marmalade-edk
crocodoc
mvccontrib
css-tables
moq-3
autostart
javascriptserializer
gjs
flash-cs5.5
shared-objects
galaxy-tab
cookieless
jquery-ui-button
graph-layout
database-diagramming
self-reference

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App