Date post: | 17-Dec-2014 |
Category: |
Technology |
Upload: | jhenry |
View: | 6,971 times |
Download: | 3 times |
Look, Ma! I’m on the Internets!
•delicious/kapowee •vimeo.com/bootstraps•flickr.com/zappowbang•twitter.com/jhenry•upcoming.org/jhenry•goodreads.com•yelp.com•linkedin.com•brightkite.com•friendfeed.com/puddlestomping
Simple Social Networking With
Rails•What is a social network?
•Why build a social network?
•How might one build a social network?
•Hey, look, an example!
What is a social network?
•Context of web applications
•Wikipedia has more on the broader, sociological concepts:
•http://en.wikipedia.org/wiki/Social_network
What is a social network?
•Provides a Utility/Function (Content)
•Content is still king
•Content tends to be user-generated, controlled, and owned *
•Content interaction patterns (generating new content, sharing/republishing, modifying/remixing)
What is a social network?
http://www.flickr.com/photos/vj_pdx/144902289/
What is a social network?
•It's People!
•user relationships are many-to-many
•a blog is one-to-many
•User interaction patterns (friendships, fans, friends-of-friends)
Why build a social network?
•What are you selling?
•Idea, product, theology, movement, etc.
•Why will your users come here?
Why build a social network?
•What channels do you currently reach with your customers?
•How are you interacting with your customers?
•How do your customers interact with each other?
•How do your customers interact with their customers and others around them?
Why build a social network?
•The evolution of the newsletter
•newsletters -> email lists -> blogs -> social networks?
Why build a social network?
•It's fun!
•Crowdsourcing
•Think small - it doesn't have to be the next Facebook.
•Put The Service and The Community back in community service
•Scratch that itch
How do you build a social network?
•Join as many as you can!
•Get a feel for what others are doing
•Consider this an education in UX/UI
•Reading blogs or books will help you become a better writer, so...
•Using these applications will inform your development process
How do you build a social network?
•What will our data look like?
•Users
•Relationships (friends/fans)
•Content
Pre-Fab vs. Home Cookin'
•Building from Scratch
•It's not too far off from the build-a-blog in 5 minutes example
•Just need a few more models, right?
•Add in a few plugins....
Home Cookin' - Example
Relationship
Text create_table :connections do |t| t.integer :person_id t.integer :contact_id t.integer :status t.timestamp :accepted_at t.timestamps end
create_table :connections do |t| t.integer :person_id t.integer :contact_id t.integer :status t.timestamp :accepted_at t.timestamps end
Insoshi's connections migrations:
Home Cookin' - Example
Relationship
create_table :friendships do |t| t.integer "user_id", :null => false t.integer "friend_id", :null => false t.datetime "created_at" t.datetime "updated_at" t.timestampsend
create_table :friendships do |t| t.integer "user_id", :null => false t.integer "friend_id", :null => false t.datetime "created_at" t.datetime "updated_at" t.timestampsend
Daniel Fischer’s “Fischy friends” example:
Home Cookin'
•A few plugins and tools for consideration:
•Paperclip
•acts_as_commentable
•acts_as_taggable_on
Pre-Fabricated
•Refactoring other people's code is a great way to learn
•Leaves you with the time to focus on implementing features, etc
Pre-Fabricated
•Community Engine "plugin"
•Insoshi platform
•Ning (furniture included!)
•Bort, etc (just the walls, please)
Enter Insoshi
•Advantage: a lot of pieces are pre-biult
•galleries, forums, blogs, messaging, activity feeds, events
•Disadvantage: a lot of pieces are pre-built
•may be lots to change or retrofit
Inshtalling Insoshi
•To sphinx or not to sphinx?
•installing sphinx on OSX is a pain - need to add symlink, i.e.:
• $ sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql
•To install without sphinx, just skip that part of the install process.
Building on top of Insoshi
•Yaay, I've got tests, yaaay!
•Users and relationships already exist
•Choose a model(s) to repurpose as needed (i.e. for custom content)
•Build new model(s) for custom content and interactions
Example App - MyEventCarbon
•App for attendees/promoters of local events:
•See the carbon footprint of their events
•Organize carpools
•Suggest bus routes and other alternatives
Example App - MyEventCarbon
•Repurpose Insoshi's nascent event model
•Use Gmaps api for geocoding
•AMEE for carbon calculations (amee.com)
Example App - MyEventCarbon•Plugins
•ym4r for embedding google maps
•rspec_response_enhancer - add more descriptive output to rspec
•Floppy-amee - for interacting with AMEE data
Example App - MyEventCarbon
Example App - MyEventCarbon
Example App - MyEventCarbon
Example App - MyEventCarbon
Example App - MyEventCarbon
create_table "event_attendees", :force => true do |t| t.integer "person_id" t.integer "event_id" t.string "origin" t.string "distance" t.string "carbon" end
schema.rb
Example App - MyEventCarbon
belongs_to :person has_many :event_attendees has_many :attendees, :through => :event_attendees, :source => :person, :select => "event_attendees.origin, event_attendees.distance, event_attendees.carbon, people.*"
app/models/event.rb
Example App - MyEventCarbon
•Carpooling?
•How to build a carpooling feature in?
•What would schema look like?
Example App - MyEventCarbon
create_table "communications", :force => true do |t| t.string "subject" t.text "content" t.integer "parent_id" t.integer "sender_id" t.integer "recipient_id" t.datetime "sender_deleted_at" t.datetime "sender_read_at" t.datetime "recipient_deleted_at" t.datetime "recipient_read_at" t.datetime "replied_at" t.string "type" t.datetime "created_at" t.datetime "updated_at" t.integer "conversation_id" end
You could modify an existing model:
... but that could impact other parts of the system.
Example App - MyEventCarbon
class CreateCarpools < ActiveRecord::Migration def self.up create_table :carpools do |t| t.integer :person_id t.integer :contact_id t.integer :event_id t.integer :status t.timestamp :accepted_at
t.timestamps end
A new table might be more appropriate:
Duplicate the connections table, add an event_id and whatever other fields as
needed.
Example App - MyEventCarbon
•Next steps
•Carpooling offering/accepting/tracking
•“Live” carbon calculations
•Pull events from other services (upcoming, eventful)
•Import ical files, RSS, microformats (hcal)
•Adding to activity feed
•backchannel integration
Moving forward
•Your homework: Join some more social networks and start using them.
•They work best when people you know (that's us) are using them with you
•Join me! Some of my networks are listed at http://friendfeed.com/puddlestomping
Sourced/Resourced• Wikipedia article on "Social Network"
http://en.wikipedia.org/wiki/Social_network
• Jim Neath > Building a Social Network Site in Rails: http://jimneath.org/2008/04/25/building-a-social-network-site-in-rails/
• MissingMethod > How To Build a Social Network with Ruby on Rails: http://www.missingmethod.com/2007/01/08/how-to-build-a-social-network-with-ruby-on-rails/
• Friendship model examples & self referential models:
• Dan Fischer > Fischyfriends: http://github.com/dfischer/fischyfriends/tree/master
• Josh Susser > Self-referential has_many :through associations: http://blog.hasmanythrough.com/2007/10/30/self-referential-has-many-through
• Installing sphinx on OSX: http://www.sparkboxx.com/sparkboxx/2008/10/installing-ultr.html