Solutions Architecture Blog

April 2007 - Posts

Colts Cred Architecture
by Mark Strawmyer 04.29.07

Comments    No Comments

As we get closer to wrapping up the initial development on MyColts.net and releasing a public beta I was working out the design and implementation for the "Colts Cred" system.  The intent is to give away credibility points to people for various actions and help entice people to take desired action.  The first trick is to figure out the actions that will result in points being given, which was pretty straight forward.  I simply ran through the bulk of the functionality within the network and made a note of various actions (positive or negative) that could occur such as creating a blog entry, making a friend, commenting on a post of some sort, uploading photos, etc.  I then assigned an arbitrary positive or negative point value to each action knowing they are going to change.

Then came the fun part.  Working out a design that allows us to give away points in a way that won't chew up performance or add a ton of storage requirements.  Additionally allowing the point values for actions to be point in time so that certain actions could be promoted through "double points" type offers.  The solution to changing point values is pretty straight forward, which is just a name and value pair table.  For each action there is a name assigned to it and a point value assigned in the table to that name.  So when an action is taken the lookup is done based on the action name and points can be awarded or taken away based on the positive or negative value in the database.

The first inclination for the actual points was to just do an aggregate number that has total points and would be credited or negated with any action.  That certainly satisfies performance by having a rollup number available for use at any time for any user, but testing would be next to impossible to verify accuracy.  So we settled on a hybrid.  There is an audit table that has a record of the profile, action, points given or taken away at the time, and a flag indicating if the points have been applied to the running total or not.  There is a SQL Integration Services job that will periodically rollup the additional points, set the applied flag on audit records, and then update the aggregate total.  We can baseline the audit trail at any point if it becomes too big by recording the point value for each profile at the point the audit trail was cleared and then capturing the audit trail from that baseline.

The additional benefit of all of this is the work was all pushed to the database without resulting in extra calls from the web servers.  We simply added a stored procedure call to the end of most of the insert or update stored procedures, which took care of writing entries into the audit trail. 

Now at some point I suppose we'll have to work out what exactly you can do with the points, but we've already had quite the competition in the testing team to see who shows up in the top of the Colts Cred list!

Friendlist Permission
by Mark Strawmyer 04.11.07

Comments    No Comments

One of the more complicated aspects of MyColts.net to implement is what we're calling friendlist security.  It allows you to control different views of your content and profile based on groupings you setup.  It gives you full control over who can see what information that you publish.  Thus, if your boss were to checkout your mycolts.net profile he may indeed see a completely different version of your content than your friends.

To make this work we started with a role based security system controlled by each user.  It is a classic create groups, put users into groups, and then assign permission to the groups scenario driven by each user.  Different components of the system (calendars, blogs, comments, photos) etc then plugin to the role based security system to govern the overall content and who is allowed to see it.  The UI relies on knowing the friendlist assignments by the content creator and comparing it to the intersection of assignments given to the current person viewing the content.

The implementation involves a single Permission entity.  That permission entity has a globally unique identifier (GUID) on it.  The GUID is stored along with the entity that owns the permission such as a blog or photo gallery.  When the permissions are edited the GUID is then joined to the permission list table for all of the profiles, friendlists, and groups that have been assigned rights to that content.  When there are no permissions assigned we set a bit flag indicating public permissions so that the rest of the permission checks can just be avoided if it is considered public content.  Since it is a social networking site we decided to use least restrictive rather than most restrictive on default permissions to try and encourage folks to share content.  Since all permissions are stored in a single set of tables we have a single control that can be used to edit the permissions on any entity type.  You simply bind the control to the permission GUID and it will allow you to edit and maintain the permission assignments and persist them back to the database.

There are a couple of joins required to check permissions on any entity, but so far the dynamics and flexibility of it have off set any performance issues.  Not to mention we've indexed the heck out of it.  It has proven quite a challenge to test.  There are individual, friendlist, and group assignments to consider.  Any number of times we've been convinced we found  a problem only to find that a user was a member of a group we didn't realize had permissions that was granting them access.  I'd heavily encourage anyone trying to build something similar to have some very explicit and detailed test cases to save yourself hours of headache and chasing phantom problems.

Story Board Design Process
by Mark Strawmyer 04.02.07

Comments    No Comments

For the design process on MyColts.net we've been using a story board type design process that flows something like this:

  • Upfront discussion about the site area / page and what functionality and purpose it will serve 
  • Build a wireframe of the site area / page 
  • List of functionality that the wireframe will support 
  • Detailed graphic layout with example functionality 
  • Construction of the item 
  • Refactor based on feedback and use once it is plugged into the actual site 

The drawback to the process is the duration.  It can be tedious and time consuming to draw up the screen mockups for the site and adds time to the overall project.  It may have been a different experience if we had a dedicated designer, but unfortunately the on field success of the Colts has prevented that (a sacrifice we've all happily made).  Additionally, it has proven a challenge to be consistent with colors, styles, and behaviors across the screen designs.  There are new items that can often pop-in unannounced.

However, this has proven to be a pretty effective design process for us throughout the duration of the project.  We've had some good discussions around various pages and topics and found the upfront discussions help make sure concepts are better thought out up front.  It is a pretty visual process, which seems to especially benefit the programming team when it comes down to the actual construction and being able to implement the vision.  Folks that aren't naturally graphic inclined have a model to make the functionality jump from the start.  It's worked far better than detailed program specs and is a process I'd recommend considering.  As tools such as Microsoft Expression become more widely adopted perhaps adding more visual elements (right brained) to a classic programming (left brained) lifecycle will make story boarding even more practical and widely adopted.  I'd love to hear if this has worked for others.