views:

39

answers:

0

I'm working on a time management project and looking for some practical object / persistence models. Fowler has some great ideas on resource allocation in his Analysis Patterns book, but many are overkill for what I need right now, and by design, highly conceptual (as opposed to implementable)

The focal conceptual object I'm thinking of would be an Allocation object, which looks something like:

Allocation : Entity
-------------
Id : Id
ResourceId : Id
AtivityId : Id
EventDate ; DateTime
TimeSpent : TimeQuantity

I'm also thinking this would be a database table, although I'm not sure if it would be an associative table between Resources and Activities, or a stand-alone lookup table (with the domain enforcing referential integrity).

The other two conceptual objects would be the Resource and the Activity. Both would have a set of Allocations, but after that I'm a bit stuck in thinking out the interfaces. Different types of StaffMembers and Consultants are Resources of interest. The primary interest of an Activity would be based on a Project, with NonProject activities based on various payroll Accounts.

This is a c# project using nhibernate.

I realize this is a broad question, and not really a question about programming per se. If anyone knows of a more appropriate forum to discuss this, that would be great. If you also have some experience with this domain and have some ideas or links you are willing to share, that would be fantastic!

RESPONSE TO ORBMAN

Good questions:

1) Whose time is tracked (Resources), which can be
- FullTimeStaff
- AdminStaff
- Consultants
2) recording period is weekly
- User can enter and revise time spent at any time prior to posting
- timesheets must be posted for department manager review every week (Sunday) (System will not let the user post unless weekly quotas are met)
- manager has until the following Tuesday to approve / reject
3) time must be allocated to Activities, which are two basic types
- Project based activities
- non-project activities (which winds up posted to various P/R accounts)
4) reports by either a Resource or an Activity s/b available over ad hoc time periods.

The main problem I hit centers around the polymorphism needed for both Resource and Activity and how it should be persisted. In the domain it's more useful to have an IResource or IActivity, both of which implement IAllocatable: UniqueId : Id BusinessId : string Description : string Allocations : ISet

The constraint that a Resource can only allocate time to an Activity is what makes them different (Activity needs a ClockIn method and Resource does not). Both need to be wrappers for well known objects that serve other purposes in the system (ie, StaffMember, Project).

I need a unique id for persistence and maybe a surrogate key for the allocation itself. I'm also not sure if there must be referential integrity between the allocations and the wrapped resources / activities and how to map that if so. I have been using Fluent NHibernate but I think it might wind up being easier to just use NHibernate.

Thanks again for the good questions.