4 ms·
> bundling data along with methods which operate on that data What can you possibly believe a class is other than exactly that?
by njharman 15y ago
> bundling data along with methods which operate on that data
What can you possibly believe a class is other than exactly that?
- haldean 15y agoPolymorphism and type hierarchies.
- daviddaviddavid 15y agoI realize that is one thing that classes offer. My point is that you can achieve exactly the same thing with objects rather than classes. Very often when writing Python (or whatever) you'll create a class which is only ever instantiated once and the instantiation is done simply for the benefit of calling one method. In such cases I find classes to be overkill. What I really want is the object. I don't need to factor the object's behavior out into a class. Many of my sympathies are expressed much more thoroughly and eloquently in the many papers you can find online by Walter Smith outlining the motivations behind NewtonScript.