Carpool Project: Part #1
October 13, 2010 Leave a comment
There are some kids in the neighborhood that need to get a lift over to a local swim center for swim team practice. The swim team practices year-round.
Currently, there is an Excel spreadsheet on a Live Account. I went to add functionality to the Excel spreadsheet and learned that you cannot do conditional filtering in an on-line copy.
I checked out some on-line carpool sites and realized they were a bit of an overkill
I then thought I can build a car pool site and in the process, work through using the Architectural features of VS2010 and apply what I am learning in Domain Driven Design.
Step #1: Set Up the Infrastructure
I set up the needed infrastructure on WinHost and locally for the new solution. I won’t go into the details here.
Step #2: Set Up the Domain Model and Use Cases/User Stories
I opened VS2010 and set up a basic class diagram that captures the data elements that are included in the current Excel workbook. I added multiple swim teams in case there are some people in the neighborhood that want to jump in…
Based on this class diagram, I started entering some user stories into TFS (I am using the Agile template). Here is the 1st one:
Here are the user stories:
Notification
· The carpool that my child is in now has a driver
· Your child is in a carpool without a driver and the practice is less than 24 hours away
· Admin notified on an error
Action – Standard User
· Need to sign up for a day
· Need to cancel for a day
· Need to add a child to a car pool
· Need to remove a child from a car pool
· Need to see the weekly schedule of carpools
Action – Administrator
· Need to add a new swimmer
· Need to add a new driver
· Need to change a swimmer to a new Swim Group
Non-Functional
· Person signs into the site
· Person changes their password
· Person updates their contact info
· All errors and logins are logged
I then thought about the POCOs that would be part of the ViewModel so I went back to my stories to identify the data elements that each story includes. I created my 1st query of all of the work items that I put into TFS. As you can see, I screwed up – I mistakenly made all of my User Stories Work Items:
Also, with the multiple practices, I realized that I needed to add the ability for the standard user to add new practices to a day, and then determine if 1 or 2 car pools are needed. Also, looking at the class diagram and reading DDD, I see that I need to add more stories. For example, does swimmer have an entry point? If so, then who can add/remove swimmers?
I looked at the class diagram again and realized I had to add for some more changes -> cars might have a max capacity, but the actual capacity changes for each trip – depending if there are siblings along for the ride. Also, the notion of the car is not needed, the trip can tell you who is the driver and the capacity allowed for the trip. My model changed to this.
I then went through Domain Driven Design – Chapters 5 & 6 – and tried to identify the Entity, Value, and Aggregate objects. Below is my initial thought.
The Root Entity is Trip and Practice. However, this is not right because the Root Entity has a global identity and the entities inside the aggregate are unique only within the aggregate. That is not the case – for example, the swim team is unique for the entire graph. The fact that the driver is not associated with the swim team doesn’t mean they are in different aggregates. Also, since nothing outside of the aggregate can hold a ref to the inside entities and Swimmers clearly need to be associated with a Swim Group/Team, this separation is not going to work.
After reading some more on aggregates and the canonical example of purchase order/line items, I think that I don’t have any aggregates.