I have a design question..
I have an application where core api is in Java and interacts with sybase at backend..
In several requirements, we need to enhance our code to include Sybase cols as for example:
Calculaiton Method can be of many types for examples:
and based on the fields we get from sybase DB, we apply appropriate calculation method to our calculations..
Now there are 2 ways to achieve this req..
1). we enhance to include col in table which has int in sybase --
NOE= 1, Simple = 2, etc and then from java -- we get 1,2 or 3 and based on this we pick the appropriate class to apply calculation method..
downside -- we need to remember that NOE =1 , Simple =2, maintain in Constants class or somewhere and always refer to that if we forget or even preparing a report say for example ..
in sybase, we need to pick all the rows which are set for NOE .. Now we will need to pick all rows where calculation method = 1 and then in excel change to NOE to send to business correct?
Good thing in this approach is -- better performance since we are just storing int's in sybase..
other way of doing this..
in sybase -- add a col (varchar) which stores NOE, Simple (exact strings).. and based on strings apply the calculation method --
downside - I guess it will not perform so good compare to 1..
good thing -- more descriptive, easy in case of prod suppport or report prepartion..
Similarly we have req for precisions --
currently we have only one col of precision where we store:
-1 means 1 Truncate
1 means 1 Round
But now we have to start storing --
precision value and precision type
where precision value = 1,2,3....
precision type = ROUND, TRUNCATE, ROUND_UP, ROUND_TO_NEAREST_WHOLE_NUMBER etc...
so Not sure what should be the best way to achieve this..
Please advise ideas or alternate suggestions of what is the best way of doing this..