patternMinor
Classes and Algebras: Which begat which?
Viewed 0 times
algebraswhichclassesbegatand
Problem
Way back in the day I took a course on discrete structures and learned about how the mathematical notion of an algebra is akin to the class data type.
But I didn't know enough at the time to ask whether algebras are used to model classes or whether classes are actually derived from algebras (historically, technically...in whatever sense of 'derived' you like).
Wikipedia and Google weren't much help. Anyone have any idea?
But I didn't know enough at the time to ask whether algebras are used to model classes or whether classes are actually derived from algebras (historically, technically...in whatever sense of 'derived' you like).
Wikipedia and Google weren't much help. Anyone have any idea?
Solution
I'm not sure I fully understand your question, but I think you noticed that algebras (or more precisely algebraic signatures) and classes share a feature, namely that they both can be seen as specifying a bunch of operations. For example the algebraic construct group has three operations: multiplication, inverse and the constant $1$. Now you ask if algebras can be used to model classes.
The answer is negative at this point. Classes in the sense of OO programming are complicated beasts. They have features that algebras don't have, in particular computational dynamics. There are other features like inheritance, method overriding, mutable private members that also
don't lend themselves to easy algebraic description. For this reason, purely algebraic sematics of OO languages don't exist.
As to the historic question, I don't know. The development of types goes back to the end of the 19th century, a time when abstract algebra was in nascent form too
The answer is negative at this point. Classes in the sense of OO programming are complicated beasts. They have features that algebras don't have, in particular computational dynamics. There are other features like inheritance, method overriding, mutable private members that also
don't lend themselves to easy algebraic description. For this reason, purely algebraic sematics of OO languages don't exist.
As to the historic question, I don't know. The development of types goes back to the end of the 19th century, a time when abstract algebra was in nascent form too
Context
StackExchange Computer Science Q#19636, answer score: 2
Revisions (0)
No revisions yet.