A suggestion assigning responsabilities in OO Analysis
Hello everybody!
I am working to a project and I have a issue about giving responsabilities in OO Analysis for which I kindly ask your suggestions.
The project, in brief, is about a system which has to manage the money an institution (e.g: Association for cancer research) donates to a research lab
to support its activities. Such a donation is called a "Fund" (eg: research on breast cancer 2007) and in it you can register Researchers (people who work in it) and keep under control every movement of money.
The class diagram i drawed is shown here:
http://img294.imageshack.us/my.php?image=classdiagramst5.gif
My problem is that in theory the class Fund could have all the responsabilities (add a researcher, add an outlay, etc) but I know that this would be not the best thing to do.
I thought of giving the "important" responsability of adding an Outlay to another class, Outlay. This responsability includes checking if there is still money avalaible in the voice corresponding to the description (Eg: I cannot insert an outlay of 1000$ with description salaries if I have 999$ available in my fund for this voice in the current year). Furthermore, it should check that if the user wants to register a salary outlay, s/he has selected also the researcher that got this payment.
So, giving the responsability to the Outlay class would mean to let it "talk" a lot with the Fund class (Eg: asking how much money is still available for a certain voice in the current year, asking wehter a researcher works for that fund, etc).
My question is now: in good OO analysis, I should assign the responsability to the Outlay class without caring of the amount of messages exchanged with Fund or indeed assign this responsability directly to Fund (paying the cost of a class with a lot of responsabilities and others with very few resps)?
I would really appreciate any kind of help/suggestions. I thank everybody since now!
Bye

