A Categorical View of Differential and Difference Algebra