Discussion:
Is FP suitable for complex business logic?
(too old to reply)
Simon Shi
2011-08-03 06:32:31 UTC
Permalink
Let me describe the current application:
1. maintaining hierarchical resources (e.g. companies has dozens of departments, one department has hundreds of workshops, one workshop has thousands of workers), data organised like a tree.
2. Create/Modify/Delete these resources will do various calculations, e.g. decrease total quota in upper-level resource based on its properties and upper-level's properties; configuring several workshops as a group, thus need to involve them all in some calculations.
3. each resource will setup(Cre/Mod/Del) corresponding Hardware resource, so the resource node contains not only properties but also HW related data, the data in the tree grows continuously in development. (it's now very big one)
4. calculations changes: add new one, involve/discard some parameters, etc.

After several years change, many functions created/modified based on the big data tree, looks like a big ball of mud, it's a maintain nightmare.

So, do you have suggestion on how to organize the desgin? is there any opensource project solved a similar problem?
Torben Ægidius Mogensen
2011-08-08 14:15:36 UTC
Permalink
Post by Simon Shi
1. maintaining hierarchical resources (e.g. companies has dozens of departments, one department has hundreds of workshops, one workshop has thousands of workers), data organised like a tree.
2. Create/Modify/Delete these resources will do various calculations, e.g. decrease total quota in upper-level resource based on its properties and upper-level's properties; configuring several workshops as a group, thus need to involve them all in some calculations.
3. each resource will setup(Cre/Mod/Del) corresponding Hardware resource, so the resource node contains not only properties but also HW related data, the data in the tree grows continuously in development. (it's now very big one)
4. calculations changes: add new one, involve/discard some parameters, etc.
After several years change, many functions created/modified based on the big data tree, looks like a big ball of mud, it's a maintain nightmare.
So, do you have suggestion on how to organize the desgin? is there any opensource project solved a similar problem?
See http://www.3gerp.org/, which does much of what you want (and a good
deal more). And it is mostly imlemented in Haskell.

Torben
Rock Brentwood
2011-10-01 04:00:56 UTC
Permalink
Post by Simon Shi
1. maintaining hierarchical resources (e.g. companies has dozens of departments, one department has hundreds of workshops, one workshop has thousands of workers), data organised like a tree.
2. Create/Modify/Delete these resources will do various calculations, e.g. decrease total quota in upper-level resource based on its properties and upper-level's properties; configuring several workshops as a group, thus need to involve them all in some calculations.
I'm thinking of logic programming, instead, and Prolog; because of it
has conversion to/from SQL and can be connected to database
facilities, like Windows ODBC. SWI Prolog has these facilities.

But what I'm really interested in is getting an closely-knit
integration of the functional and logic paradigms, with the type
system firmly entrenched in the Curry-Howard correspondence ... so,
the "existential type" is the data abstraction facility, and the
"universal type" is the parametric polymorphism facility.

This is a tall order and it leaves unresolved whether the Curry-Howard
correspondence should be tied to the logic programming aspect. At the
very least, the backtracking facility should be subsumed into
functional programming as a multi-valued function facility. This is
where the tie-in to relational databases would then occur.

Loading...