This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
"Instance" is a more general concept. As written above, an instance of a class is an object. An instance of an association is a link (that is, between classes you have associations, between objects you have links). An instance of a DTD or XML-Schema is an XML-file. Does that help?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Joined: Nov 17, 2001
Hi, Thomas and Ilja, Your answes are useful. I am still not very clear about the instance and object of EJB. It seems they have some diiferent meaning. For Entity Bean, the application server creates instance, but it is assigned to an remote object only after the create method in the home interface is called. Does someone have some ideas about the instance in this case?
Joined: Jul 11, 2001
Originally posted by Mike Yu: For Entity Bean, the application server creates instance, but it is assigned to an remote object only after the create method in the home interface is called.
The instance they are speaking of is the object that is instanciated by the application server - the actual entity bean. The remote object is an instance of the remote interface. Does that make things clearer for you?
Their meanings are very close so if you are having trouble differentiating them, its ok. An object is created from a class. Many objects may be created from the same class. Each of these objects will be referred to as "instances" of that class. So an object is always an instance, and an instance is always an object. ClassA refA = new ClassA(); ClassA refA2 = new ClassA(); ClassB refB = new ClassB(); ClassB refB2 = new ClassB(); refA,refA2,refB,refB2 refer to objects; refA,refA2 refer to instances of ClassA; refB,refB2 refer to instances of ClassB;