I've lately been thinking a lot about alternatives to the class-based approach to object-orientation. One thing which bugs me in today's languages is that we often use static classes / singletons to design single (global) objects because there isn't any other way to do it, so in my opinion it's rather a hack than a feature. Another thing is that Java for instance allows the programmer to have enums with additional data (global state) and functionality which make them kind of object in my eyes, too.
Anyway, what I'd like to know is whether you have any ideas for a different approach to object-orientation in a compiled and efficient language (therefore, creating objects by prototyping is probably not a good idea) or, if you don't have any, whether there're things in the classic OO approach which bug you a lot, too.
[EDIT]: Just to make things clear. As indicated above I already know prototype-based programming.
How to aggregate all attributes of a hierarchy of classes?
Dynamically attaching a method to an existing Python object generated with swig?
DO I need to create a new object to use a classes functions more then 1 time on a page?
Class design: allow a class to be used both as an object and also supply public static methods
C++: Hide base static member
Python: Automatically initialize instance variables?
It's something like classes except for being asynchronous.
In Perl are there disadvantages to generating getters and setters rather than hard-coding them?
If each actor is a Finite-State-Machine, you would have a potentially powerful system.. Erlang uses something like that, I'm told...
at least similar.
The point with the actor model is that it doesn't need to be implemented purely, and so does not need to be part of Erlang.. I started a small language that used that model once a few years ago.
I might try it again sometime..
First, producing a good taxonmy is hard.
People suck at creating them.
Secondly, I am not convinced that you can actually structure a sensible, maintainable, hierarchy that will withstand change in a project containing a lot of entities; the whole practice of refactoring is basically acknowledging the difficulty of creating large, all incompassing taxanomies.
. Actually, I think that OOP is over-engineered.
Everything you can do with OOP can be done with higher-order functions (HOFs).
HOFs are much more elegant, much more flexible solution to the same problems that OOP tries to address.. So if you're asking of another way to do OOP style stuff, HOFs are probably the closest alternative technology that has a similiar level of flexibility..
Is the signal method in Objective-C classical or the static method in standard C++?. In functional languages, it's easy enough to have non-object functions that, in a sense, act like objects because they return functions whose implementations are opaque.
For example, the following code in Scheme.
will output a function which isn't officially an "object" but it can act like one since it stores state, but you're not very clear about what exactly is wrong with the object-oriented paradigms you have been exposed to..
(define (create-ball color) (lambda (attribute-name) (if (equal? attribute-name "color") color "method-not-supported"))))