• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

OO Basics

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all:
One of the my colleagues who is learning OO asked me a question, which I stumbled while answering.
Q:"What is the difference between object and instance".
answer: same
Q: why two diff names
answer: terminology.
Q: Any specific reason.
answer: will think about it.
Q: There must be some difference between the two?
what do you think.
Regards
Gunjan
 
Desperado
Posts: 3226
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am moving this topic to the Object Oriented (OO) section where it will get the attention it deserves.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think that the word "object" is kind of, ummm, overloaded. It can refer to the general concept of objects, as in "Object-Oriented Programming" (which is really just as much "Class-Oriented Programming"), or it can refer to the class Object (well really it doesn't unless you capitalize it, but this doesn't work in speech and people often get it wrong anyway), or, most commonly, it can refer to an instance. If you want to talk about an instance and be sure people know what you mean, it's safest to say "instance", IMO. I think people were using "object" first until they started using "instance" to resolve this ambiguity.
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In Java each object must be an instance of a class, so the terms are effectively synonymous, but this doesn't hold true for all OO languages.
Not all OO languages are class-based. One fairly common alternative is prototype-based OO (eg. Self, Brain etc.), where each object is a modification or specialization of another object. In such systems, no object is really an instance of anything, there are no classes, just objects.
 
Tony Alicea
Desperado
Posts: 3226
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where would you put JavaScript? Under Object Oriented or Object Based? SOmething else? And what is the difference between OO and OB? Thanks.
 
Frank Carver
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Object Based (OB) is usually used to mean a system which has objects (and probably classes) like an OO system, but only offers a limited ability to define and create your own objects. Both JavaScript and Visual Basic are commonly considered as part of this group :- defining a new class in JS is almost impossible. In VB it is at least possible, but not part of the main language syntax.
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Frank,
You are close ,you should have said that OB don't have inheritance at all whereas OO was mostly inheritance until a few years ago ,now it's both Inheritance and Composition. An extreme form of composition is Delegation.
Rgds
Amit

Originally posted by Frank Carver:
Object Based (OB) is usually used to mean a system which has objects (and probably classes) like an OO system, but only offers a limited ability to define and create your own objects. Both JavaScript and Visual Basic are commonly considered as part of this group :- defining a new class in JS is almost impossible. In VB it is at least possible, but not part of the main language syntax.

 
I was born with webbed fish toes. This tiny ad is my only friend:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic