A tremendous amount of effort and processing goes into casting a vote on SO. I am in the process of writing a similar system and I would like to know what were the most challenging technical aspects to implementing your system cleanly and reliably.
My observations thus far have led me to deduce the following:
A vote requires a COUNT(*) query on daily votes to enforce voting limits.
A vote requires retrieving the original post to validate: a) You are the question owner, if you are accepting the answer. b) You are not the post owner, if it's a mod vote. c) The age of the question, in order to accept an answer. d) The age of the question with a different criteria, if you are accepting your own answer. e) The post is also needed to determine the amount of reputation to update. 5 for a question and 10 for an answer in case of mod votes. 15 points in case of an accepted answer.
The system must query to update the voter reputation, and numbers for modup/moddown votes.
The system must query to update the question post if an answer is being accepted.
The system must also query to update the reputation of the vote rcepient.
A new vote record must be created.
Changing an accepted answer must be a bit nightmarish for all the above reasons and crediting/deducting reputation, etc...
Various decisions must be made on awarding badges,
All this must be done with transactions.
It seems like a frightening and daunting task. Are there any tips or things you learned from experience that can be helpful to someone trying to undertake the same task?