Correct type for a simple "bag of attributes" namespace object

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Aug 3 20:13:33 EDT 2014


Marko Rauhamaa wrote:

> I've reached a point where I think classes are a superfluous OO concept.
> You only need objects.

I don't know whether "superfluous" is correct, but they certainly are
*optional*. There are at least two types of object oriented programming:
class-bases, and prototype-based. Java, Python, Ruby, etc. are all
class-based. The only example of a prototype-based OOP language I know of
is Javascript, and even that has recently gained the ability to define
classes.

I don't know enough about prototyped OOP to really give a definitive answer,
but I believe that the popularity of class-based OOP is because there is a
huge body of theory on types, which makes it easier for compiler designers
to reason about classes than prototypes. For example, if Haskell introduces
OOP (and it may already have, I don't know) I would expect it to be
class-based. Also, the first OOP languages (Simula and, especially,
Smalltalk) are class-based, and people tend to copy what's been done before
and what they're familiar with.


-- 
Steven




More information about the Python-list mailing list