Search code examples
databasesocial-networkingvoting

When creating a social voting system, should you keep track of downvotes and upvotes separately in the DB?


With things like SO, Digg, Reddit, etc...

Should one keep track of downvotes in the database independent of upvotes? Or should they simply have a "votes" field that is decremented/incremented based off what the user does with no persisting of that?

How should votes be handled?


Solution

  • On SO, up votes earn +10, down votes -2. For this to work they need to be tracked separately. It's quite possible for a controversial answer to generate a few of each, and just showing an aggregate number won't mean much. So I'd say keep them separate.