473,287 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

class-oriented rather than object-oriented?

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.

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?

are python functions objects?

can a functional language be object-oriented or an objectoriented
language be functional?
one definition of OO is a language that passes messages between
objects. but not necessarily that is has to pass message sbetween
classes?
Jun 27 '08 #1
3 1523
no**********@yahoo.se writes:
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?
The term is used (and abused) in different ways. The term "object
oriented" is usually an abbreviation of "object-oriented programming",
which contrasts with the older practice of "procedural programming".

It refers to the shift in focus, away from programs that feed data
through a mostly-linear procedural process, and toward programs that
define how objects behave and change state, and interact with other
objects.
are python functions objects?
Yes.
can a functional language be object-oriented or an objectoriented
language be functional?
Yes. Again, it's m ore accurate to say that a language *enables* a
particular style of programming. Python enables procedural
programming, object-oriented programming, and functional programming.
one definition of OO is a language that passes messages between
objects. but not necessarily that is has to pass message sbetween
classes?
Classes only exist to define functionality, including the
functionality of creating instances of themselves. It's those
instances that contain state data, and that pass messages back and
forth.

Think of a class as a type definition (and, indeed, types and classes
are now unified in Python since early in the 2.x series), and
instances as specific values of that type. The type defines the
behaviour of its instances, but the instances are what the program
actually uses.

--
\ "Madness is rare in individuals, but in groups, parties, |
`\ nations and ages it is the rule." -- Friedrich Nietzsche |
_o__) |
Ben Finney
Jun 27 '08 #2
On May 25, 4:34 am, notnorweg...@yahoo.se 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
Jun 27 '08 #3
no**********@yahoo.se a écrit :
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.
Depends on the language.
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.
InMyArms(tm) !-)
in python i dont or at leats not as much.
Fact is that Python is more concerned about objects and less about
classes. While you do have the concept of a class in Python, it's in
some points closer to javascript's prototypes. Amongst other things, the
object/class relationship is not necessarily static - you can
dynamically rebind an object to another class (whether it's a good idea
is another question), dynamicallt add/remove/replace attributes
(including methods) on a per-instance or per-class basis, etc.
>
does object-oriented refer to that everything(strings, ints etc) are
all objects?
The only commonly accepted definitions I know wrt/ OO are :

1/ an OO program is composed of objects interacting thru messages
2/ an object is defined by an identity, a state and a behaviour

So to answer your question:

Not necessarily, but having non-object "things" in an OO program somehow
contradicts definition #1 IMHO.

BTW, you'll notice that there's nowhere mention of "classes" here...
so there is a class string somewhere in the
implementation rather than a primitive or somehing?
.... nor of "primitive types" !-)
are python functions objects?
Yes. As well as classes, modules, and even the function's code. From
this POV, Python is 100% object. wrt/ to the "message passing" part,
it's probably a bit more debatable, specially when compared to Smalltalk
where messages are the only control structure.
can a functional language be object-oriented or an objectoriented
language be functional?
Well... Depends on the definitions of "object-oriented" and
"functional". There are indeed some languages that try to support both
approach, coming either from the OO side (Python, Ruby, Javascript...)
or from the functional side (OCaml, Common Lisp, Scheme, ...).

Now none of these languages are "pure" functional languages. The point
is that OOP and FP are two different and more or less incompatible
approach toward state management. OOP try to encapsulate state into
objects, while FP try to simply get rid of any shared state.
one definition of OO is a language that passes messages between
objects. but not necessarily that is has to pass message sbetween
classes?
If your classes are objects, then what's the difference ?-) And if they
are not, how are you going to pass messages between them ?

But the fact is that the concept of "class" is by no mean central, nor
even necessary, to OO. You might want to have a look at languages like
Self, Io and Javascript, which are prototype-based instead of class-based.
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Oplec | last post by:
Hi, I'm learning C++ as a hobby using The C++ Programming Language : Special Edition by Bjarne Stroustrup. I'm working on chpater 13 exercises that deal with templates. Exercise 13.9 asks for me...
9
by: mead | last post by:
What kind of classes is qualified as "concrete classes"? When should a member function in a class defined as "pure virtual" and when as "virtual"? Thanks!
0
by: Leslaw Bieniasz | last post by:
Cracow, 16.09.2004 Hi, I have a problem with compiling the following construction involving cross-calls of class template methods, with additional inheritance. I want to have three class...
21
by: Jon Slaughter | last post by:
I have a class that is basicaly duplicated throughout several files with only members names changing according to the class name yet with virtually the exact same coding going on. e.g. class...
2
by: Cari Elf | last post by:
I wrote a template class that inherits from the PUG xml_tree_walker class so that I can load data from any XML file without having to write a parser for each one. template <class T> class...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.