Both is the short answer :)
SMO, as you describe it is today almost as important as SEO. Most popular web applications (Joomla, Drupal, Impression, etc...) all have plug ins for social media that are SEO compliant.
If you are asking "how to build them", then my recommendation is to use HTML5...