Hello,

I'm trying to implement some business model in Clojure. I have several 
years of experience developing OO systems in Java. So it's still very hard 
to wrap my head to functional thinking. I hope you can help me with 
following questions.

I need a domain model for customers, contracts and features. 

Customers need to be created and modified.

You can add one or more contracts to customers. But only one contract can 
be active at a given time for a customer.

Within a contract you can add or remove features. Doing this should create 
a bill. A bill is not modifiable after creation.

The business rules are more complex in reality but I would be happy to get 
some inspirations how to implement such a thing with Clojure.

Functional programming has these immutability building block. But the 
domain model I'm thinking of has lots of mutable things that change over 
time when I execute the business actions.

Of course the "history" is also required in the solution. It must be 
possible to answer the question "what feature was booked 2 months ago".

I started a solution where a customer was a map that had some refs to other 
maps. Then I had functions to alter the content of the refs. But code looks 
ugly and using it doesn't feel functional.

How should I structure data? Where are the functions? Do I have a bunch of 
customer functions that all get a "customer map" or defrecord as first 
parameter and maybe other required parameters to do the business work? And 
another similar bunch of functions for contracts, features and bills? But 
these structures are somehow nested, aren't they?

If structure will become more clear to me, then the next questions will go 
to the "how can I persist and load all my state" direction. I would be very 
glad if you could give me hints how I can solve this in a Clojure / 
functional way. I want to abstract it so that I can use some placeholder 
code in tests without the need for a real database.

That's quite a lot my brain is thinking about. I hope it's not too much to 
find any help here. Maybe there are some example applications out there 
where I can find some ideas? All I found yet are only small snippets but no 
"working in the field with business meat" :-)

Thanks a lot in advance for your help. If anything is unclear to you please 
tell me and I will try to describe my problems more clearly.

Marc

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to