My application is used for centrifugal pump impeller design. User is allowed to change some of the properties (flow speed, dimensions, etc.) in real time through winform gui and he should be provided real time with most of the results.
There is 13 user changeable parameters and around 70 calculated ones.
Most of calculation are quite complex mathematically and one of parameter needs iteration (no more then 10 iterations).
My solutions for class which contains and calculates all parameters so far were:
- Class using properties describing user changeable parameters and methods calculating resulting parameters.
- Class which is immutable and calculates everything while created.
- Lazy solution using Lazy class from .NET 4.0
I have asked this question on CR that is from where i have got Lazy solution.
So my question is which method will be most suitable for “real time” solution? Are there any other better solutions?
I would go with solution 1, I suspect each pump has the same properties, just different values for the properties.
Any call to
GetCFMwould always return the most up-to-date calculation.If you don’t want to manually call
GetCFM, you could implement the Observer Pattern instead. Using the Observer Pattern you would trigger an handler that gets notified any time any of the properties change.Also, I suspect your understanding of real time computation is different than what’s explained in the article.