# What's the theoretical difference between class and type?

This question stems from my effort trying to learn ASN.1.

After I went through the PKCS#1 standard for RSA cryptosystem and X.680~X.683 side-by-side, I noticed that, they've defined

1. ALGORITHM-IDENTIFIER as a class, and

2. AlgorithmIdentifier as a sequence type that can be encoded using BER the basic encoding rule.

I've went through the Wikipedia pages on the subjects, in both computer science and mathematical fields. It seems to say that a "class" is more general than a "type" while "type" is more concrete than "class" on the other hand.

So what's the difference from a theoretical perspective? What are the examples? And possibly why the standard developers elect to use such terminology?

## 1 Answer

I am sure that the mentioned standard is using the terms "class" and "type" according to their basic English meaning, without referring to the scientific terms from mathematics and computer science.

In a standard you might have a parameter which identifies the general "form" of a packet, a message, a subprotocol, or even an algorithm. To name the possible "variants" allowed by the standard, one might refer to those as "classes", "forms", "kinds", "types", "groups", or similar English terms.

These terms are not used according to any scientific meaning, but become technical terms within the standard. E.g. the standard might consistently use "algorithm class" to refer to the value of a certain field of a packet, stating which algorithm was used to encrypt the payload. The standard might have instead used "algorithm type", or "algorithm kind" for the same thing, with no effect on the meaning. Usually the standard chooses a term and uses it consistently to help the reader understand it's referring to that field: using "algorithm" alone wouldn't be as effective.

It's only a coincidence that "type" is also used in type theory, and "class" is used in set theory.