An Algebraic Theory of Class Specifications