On May 25, 4:34 am, [EMAIL PROTECTED] wrote: > i have some confusion over this. > > sure a class is basically a classification, like for example an animal > or flower. and an object/instance of that class is then for example a > cat. > > an object is an instance of a class. that i know, i also know how to > program with classes etc. > > i am just confused about the term object-oriented. > > wouldnt class-oriented be more fitting? at least for java since what > you do is divide everything into classes.
Unfortunately there is a lot of confusion in the terminology. Basically, everybody uses the term "object oriented" with a different meaning. So, it is not your fault and yes, a better name for Java would be class-oriented language. > in python i dont or at leats not as much. > > does object-oriented refer to that everything(strings, ints etc) are > all objects? so there is a class string somewhere in the > implementation rather than a primitive or somehing? Yes, this is the common meaning of the sentence "everything is an object", in the sense that type(x) gives you the class of x for any x. > are python functions objects? Yes. >>> def f(x): pass >>> type(f) <type 'function'> > can a functional language be object-oriented or an objectoriented > language be functional? Yes and not. A *pure* functional language has no mutation, whereas the basic tenet of object orientation is having something with a mutable state. In practice, most functional languages are not pure, and most object oriented language also allows functional construct. > one definition of OO is a language that passes messages between > objects. but not necessarily that is has to pass message sbetween > classes? "Passing a message" is another way of saying "calling a method". In a language such as Python (or Smalltalk, or Ruby) classes as objects (in the sense that they are instances of some class, the so-called metaclass) so you can "pass a message" to the class. Notice that the message passing methaphor only works with languages with single dispatch; the Common Lisp Object System (CLOS), which is based on multiple dispatch, goes in an entirely different category (no message passing there). A generic function system is not an object system in the traditional sense (I mean the sense of Smalltalk) so it should have a different name, but the mistake has been made twenty years ago and there is nothing we can do now. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list