Every day I'm amazed by the new features in Salesforce.com.  Over the past week, I've been working with a customer to get their Customer Portal setup and functioning.  We're building some very cool functionality using the Force.com platform to expose some custom objects to their customers.

However, we ran into a situation where sharing rules needed to be setup and the UI is just a bit more than we really like our users to have to take in.  Sharing is a great feature, but the last thing anyone wants is to have a customer looking at someone elses data because a user didn't really understand what they were doing or was simply confused when they setup sharing.

This is where APEX sharing comes in.  The Force.com platform has a very cool feature where an APEX developer can write a class to handle complex sharing rules.  When I read the documentation it's relatively easy to setup, but of course like a lot of Salesforce APEX trigger code, it's imperative that it's designed to work around the governor limits.

In any case there's some good documentation online that shows how to set this up:wiki.developerforce.com/index.php/Using_Apex_Managed_Sharing_to_Create_Custom_Record_Sharing_Logic.

Happy sharing!