Master-Details relationships in Force.com are very handy but don't fit every scenario. For instance, it's not possible to implement a rollup summary on formula field or text fields. Here's a small trigger that you can use for a starter for these types of situations. The code for each class is available at GitHub for your forking pleasure.
So here's the (not very useful) use case. Sales Order is the Master object which can have multiple Sales Order Items (detail object). The Sales Order Item has a "primary" Boolean field and a "purchased country" field. Each time Sales Order Items are inserted or updated, if the Sales Order Item is marked as "primary" then the value of "purchased country" is written into the "primary country" field on the Sales Order. I'm assuming that there can only be one Sales Order Item per Sales Order that is marked as primary.Essentially this is just a quick reference on the Sales Order to see which country is primary on any of the multiple Sales Order Items. Not very useful but illustrative.
The code is broken down into a Trigger and an Apex "handler" class that implements the actual functionality. It's best practice to only haveone trigger for each object and to avoid complex logic in triggers. To simplify testing and resuse, triggers should delegate to Apex classes which contain the actual execution logic. See Mike Leachs excellent trigger template for more info.
SalesOrderItemTrigger (source on GitHub) -Implements trigger functionality for Sales Order Items. Delegates responsibility to SalesOrderItemTriggerHandler.
SalesOrderItemTriggerHandler (source on GitHub) -Implements the functionality for the sales order item trigger after insert and after update. Looks at each sales order item and if it is marked as primary_item__c then moves the primary_country__c value from the sales order item to the associated sales order's primary_country__c field.
Test_SalesOrderItemTriggerHandler (source on GitHub) -Test class for SalesOrderItemTrigger and SalesOrderItemTriggerHandler. Achieves 100% code coverage.