Views: 5.2K
Replies: 0
Archived
|
Best Design Patterns for a time-based objectGreets....I just purchased the Design Pattern Framework and I am really juiced by content I've been able to digest so far!
Though I fully intent to work my way thru the patterns as the overview suggests I have an immediate need for a better understanding of which pattern to focus on as I begin to model a time-based product. I hope you'll indulge a rather long question but I've tried to flesh out all the relevant facets with the hope that the thread will hold some value to the archive. The specific item to be modeled is time-sensitive. It differs from a conventional line item in that it carries behaviors that change over the course of time. Think of it this way... If your cart carries ties, the product is static, you model properties, color; size; material...whatever. My cart carries Webinar Registrations. I'm not going to get too specific here but want establish the general scope - registrations have needs that ties don't have - your notifications subsystem has to be more robust than just mailing 'you bought it' and 'we shipped it' messages. You have to send on message context to new users (detailed, step-by-steps) and a different context (same basic info) to veterans. Same variation of contexts exists across web-page based alerts and reports. Ties have colors [static properties]. Registrations have behaviors that change context depending on date (events that take place day of webinar are really urgent). I need a pattern where the cart item's characteristics change according to a a) point in time; and, b) which actor is interacting with the item. At any given point in time 6-10 different actor classes (manager, retailer, god, prospective client, confirmed client, etc) are looking at the cart's line item thru a different lens. But a common element to all is the point in time: how many days/hours before or after separate the event (the line item) and NOW(). Each of these actors possesses a time-line they progress thru - a set of calendar-based templates that cycle thru the same stages for each scheduled event. The v1.0 version of this app has handled those services via Plain Old IF statements: If (NOW() > 2 Weeks before the event){ emit a bloc of code for each actor. } But maintaining, refining and extending that pattern is too complex. I need a pattern that more naturally handles time/event-based properties. Initially I'm inclined to figure out how to implement an Atom/RSS subscribe/publish framework, but I tend to over-think stuff. Thanks for your patience, I am really looking forward to any guidance offered. Stephen Hueners, Feb 13, 2011
|