Hi David
david wrote:If we see a databaseManager.recalculate() in code it always raises a red flag. If it affects anything more than UI display or light business rules we will redo that task so as to not need to do databaseManager.recalculate(). Update tracking fields at the transactional level, compute stuff in SQL at the point when needed, use of merge tables, run an update statement and flush the clients, etc. This way we know that long term we are avoiding issues with data integrity, performance and burying business logic that too many calculations eventually leads to.
I seems to me that raising a red flag just for the general existence of a calculation is a bit a unspecific statement. Or do you mean it's discussable if showing the multiplication of atribute a and attribute b as a calc is a sincere solution?
And, there are just more complex requirements that are asking for a solution. Anyone used to analyse requirements, design and model software including data, is aware that the various possible solutions at hand have to be weighted against each other - with it's advantages and disadvantages. There is often not right or wrong.
By the way, if we are at it, there is, in my opinion, still one of the best topic dealt with requirement analysis (Problem Frames) to be started with here
http://en.wikipedia.org/wiki/Problem_Frames_Approachor
http://www.jacksonworkbench.co.uk/steve ... rames.htmlI don't think your proposed "solutions" (compute in SQL, merge tables, ... are in principle better as other solutions - it would be nice to see standard problems solved with different patterns though - showing the advantages as well as disadvantages.
david wrote:Our general view is that there is nothing elegant about an application with tons of calcs based on calcs, calcs with relations in them, calcs with globals in them, calcs getting summed, calcs not failing gracefully, etc. Finding that one business rule that you need to change or debug is a pain, you can't be sure if your data is coming out the end of a long calculation chain is solid, and the solution will be comparatively slow.
We basically never use databaseManager.recalculate() here. It's a situational function in my opinion and some of the uses it's being applied to in this thread sound scary to me.
I don't understand what exactly is your statement here? Tons of calcs is a unit I can't assign to software engineerig. I could get an idea if you would say a blinking warning sign should appear if for example calcs exceed the number of 10% of the given attributes in a entity relationship model, or any other measurement which is based on mathematics.
I agree that the question of how solid can we expect the result to be with a not simple calc chain. I really would like to hear from all of you! But the same question arises when the implementation is done "programmatically". Did I catch really all occuring cases, exceptions etc. Calcs can not easily solve that because there is (again) program code behind the scene to make them work.
And yes, we too (as lot's of developer colleagues) are very hard at work to find the most simple, most robust and most logical understandable solution to a given requirement - in other words the "best" one, sometimes with, sometimes without using calcs
Regards, Robert