encode

encode takes data that users are handing to us and marshals it into a form suitable for sticking it in the database. This could be anything from flattening a DateTime object into an ISO date to making sure that data is utf8 clean.

decode

decode takes data that the database is handing back to us and gets it into a form that's OK to hand back to the user. This could be anything from inflating an ISO date to a DateTime object to making sure that the string properly has the utf8 flag.