Forums Register Login

Formulas in static class

+Pie Number of slices to send: Send
Hi,

We are building an application where we have to run number of formulas, more than 50 or so. These formulas will be accessed by two different classes. I am thinking of putting these formulas in a sepearate static class and those two classes will invoke formulas on this static class. Since static class will be invoked many times will it impact the performace of the application in any way as compare to if i put the formulas directly in those two classes.

Thanks
+Pie Number of slices to send: Send
What do you mean by "access" - would those be method calls, or a static data structure in that class that is used by both client classes? I'd think that more important than whether the information is in a separate class is whether access to it needs to be synchronized (because the two clients might access it simultaneously, and the underlying data can change). If there's no need for synchronization then I don't see a problem.
+Pie Number of slices to send: Send

I would prefer separate static utility classes in such cases. But beware of multi-threading esp when 2 clasess simultaneously call the utility class . prefer to use only local variables instead of class level variables.
You save more money with a clothesline than dozens of light bulb purchases. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 815 times.
Similar Threads
Java loops- linear/log time- calculation
How Nested Static Class method include this?
which parts of java you dont like?
Disadvantages of using static variables unnecessarily
Program Specifications
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 16:31:27.