Calculation suggestion ?

T

tomo

Let's say I have some data in table named TableA and some data in TableB,
and I have to make some calculation using data from those tables.What is the
best
way to do it ? And the program needs to support mupliple calculation
versions, for example one parameter is calculated for version one with one
formula but for
version two with different formula.

1.Store formulas in DB ? Wher user clicks let's say "calculate", formulas
are get from DB, parsed and data if found from DB and calculated ?
2.Store formulas as String constants in bean (class) , and than calculate ?
3.Use factory method approach ?

Thanks in advance.




__________ Information from ESET NOD32 Antivirus, version of virus signature database 4482 (20091005) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 
J

John B. Matthews

And the program needs to support mupliple calculation versions, for
example one parameter is calculated for version one with one formula
but for version two with different formula.

This part of the problem suggests a strategy pattern:

<http://en.wikipedia.org/wiki/Strategy_pattern>

In the context of "some data in table", you might consider something
like this:

interface ExecutionStrategy {
void execute(ResultSet rs);
}

Concrete implementations of ExecutionStrategy could perform the
calculation for a strategy directly, without recourse to parsing.
 
M

Marcin Rze¼nicki

"It depends."

What are your constraints? What are your requirements? How much data are we
talking about? Is it a CPU bound application? How complex are the calculations?
How frequently and in what ways will they change? Who will change them? What
demands are there on timeliness, speed, accuracy, robustness, audit trail and
security? How will the application be run? 24/7? Batch? Manually?


Nice question, isn't it? "I have some data and I need to make some
calculation. How to?"
 
M

Marcin Rze¼nicki

Nice question, isn't it? "I have some data and I need to make some
calculation. How to?"

Oh, there actually is a suitable answer, I forgot to add. "Use Turing
machine" ;-)
 
J

John B. Matthews

Marcin Rzeênicki said:
Nice question, isn't it? "I have some data and I need to make some
calculation. How to?"

This reminds me of an old cartoon: a program manager bustles past
serried ranks of programmers saying, "You guys start coding; I'll go see
what they want."
 
M

markspace

John said:
This reminds me of an old cartoon: a program manager bustles past
serried ranks of programmers saying, "You guys start coding; I'll go see
what they want."


"Code now, requirements later." I've seen that cartoon. It was accused
of being "not team building" when it got hung up anonymously.

Mostly, it was not team building for the technical lead who had just
done exactly that.
 
T

tomo

Answers to the questions....

It's simple operations like one number+second and then multiplied by third.
The formulas for calculations will be changing on montly base, and I(admin)
will change them when I get those formulas.
Secutiry...none..
Application will be run manually..on click...the caluclation will be done...



"It depends."

What are your constraints? What are your requirements? How much data are
we
talking about? Is it a CPU bound application? How complex are the
calculations?
How frequently and in what ways will they change? Who will change them?
What
demands are there on timeliness, speed, accuracy, robustness, audit trail
and
security? How will the application be run? 24/7? Batch? Manually?


Nice question, isn't it? "I have some data and I need to make some
calculation. How to?"
 
M

markspace

tomo said:
Answers to the questions....


Not very complete answer though. Like your first post, you barely hint
at what is actually going on.

It's simple operations like one number+second and then multiplied by third.
The formulas for calculations will be changing on montly base,

Do "tables" mean SQL database? Can you just use SQL to do these
calculations.

and I(admin)
will change them when I get those formulas.
Secutiry...none..


We used to train the secretaries to run some SQL commands from a command
line, where I worked as a student lo these many years ago. If
secretaries can do it, do you think an admin can?
Application will be run manually..on click...the caluclation will be done...

I vote for running a script from a command line. You could store the
SQL commands in a file then import them, just change the formulas by
hand before you run the script.
 
A

Arne Vajhøj

John said:
This reminds me of an old cartoon: a program manager bustles past
serried ranks of programmers saying, "You guys start coding; I'll go see
what they want."

Dilbert ?

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top