SharePoint 2010 allows the deployment of a solution package as a farm solution, (similar to how it works in SharePoint 2007) but it also allows the deployment of a solution package as a sandboxed solution, which reduces the scope of deployment from the level of the farm to that of a single site collection. Sandboxed solutions mitigate risk that custom code could cause and it does by restricting the API’s that can be called and governing resources that can be used.
Here are some interesting references:
MSDN: Developing, Deploying, and Monitoring Sandboxed Solutions in SharePoint 2010
Intro to SharePoint 2010 Development: How to Build and Deploy a Web Part
Eric Shupps on SharePoint 2010 Code Deployment, Part One
MSDN Sandboxed solutions