Hello all,
Could some one explain what “instance side” means? And please keep this as basic as you can, thanks,
Julian |
Hello Julian,
JD> Could some one explain what instance sidemeans? And please JD> keep this as basic as you can, thanks, in object land (Smalltalk) programs are messages sent to objects. Objects are instances of classes. So if a message is meant to go to an instance of a class (big majority) it is defined on the instance side of the class. If it goes to the class itself it is defined on the class side. If you open a browser, select any class, you will find two buttons below the class pane, one named instance, one named class which will show you two sets of methods one set defined on the instance side the other set of methods defined on the class side. The latter are usually much fewer than the first. Something to enter and doIt in a Workspace, remember messages to instances are defined on the instance side, messages to classes are sent to the class side: myRectangle := Morph new "here the new message goes to the class Morph to create a new instance, which can be referred to through the variable myMorph" myRectangle openInWorld "the instance is sent the message openInWorld, you will see a blue rectangle top left of Squeak's Window" myRectangle color: (Color green) "This is a combination: The instance is sent the message color: which needs a parameter, the expression in the (unnecessary) brackets. This parameter is created by sending the message green to the Class Color. So in a Browser find Class Morph, on the instance side you will find the message color: and if you find Class Color you will find the message green on the class side" hth Herbert mailto:[hidden email] |
Hello Julian,
should have read better before sending, so again: in object land (Smalltalk) programs are messages sent to objects. Objects are instances of classes. So if a message is meant to go to an instance of a class (big majority) it is defined on the instance side of the class. If it goes to the class itself it is defined on the class side. If you open a browser, select any class, you will find two buttons below the class pane, one named instance, one named class which will show you two sets of methods one set defined on the instance side the other set of methods defined on the class side. The latter are usually much fewer than the first. Something to enter and doIt in a Workspace, remember messages to instances are defined on the instance side, messages to classes are defined on the class side: myRectangle := Morph new "here the new message goes to the class Morph to create a new instance, which can be referred to through the variable myRectangle" myRectangle openInWorld "the instance is sent the message openInWorld, you will see a blue rectangle top left of Squeak's Window" myRectangle color: (Color green) "This is a combination: The instance is sent the message color: which needs a parameter, the expression in the (unnecessary) brackets. This parameter is created by sending the message green to the Class Color. So in a Browser find Class Morph, on the instance side you will find the message color: and if you find Class Color you will find the message green on the class side" Herbert mailto:[hidden email] |
Thank you, that's makes sense
Julian -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Herbert König Sent: 30 November 2006 19:11 To: Herbert König; The general-purpose Squeak developers list Subject: Re[2]: instance side Hello Julian, should have read better before sending, so again: in object land (Smalltalk) programs are messages sent to objects. Objects are instances of classes. So if a message is meant to go to an instance of a class (big majority) it is defined on the instance side of the class. If it goes to the class itself it is defined on the class side. If you open a browser, select any class, you will find two buttons below the class pane, one named instance, one named class which will show you two sets of methods one set defined on the instance side the other set of methods defined on the class side. The latter are usually much fewer than the first. Something to enter and doIt in a Workspace, remember messages to instances are defined on the instance side, messages to classes are defined on the class side: myRectangle := Morph new "here the new message goes to the class Morph to create a new instance, which can be referred to through the variable myRectangle" myRectangle openInWorld "the instance is sent the message openInWorld, you will see a blue rectangle top left of Squeak's Window" myRectangle color: (Color green) "This is a combination: The instance is sent the message color: which needs a parameter, the expression in the (unnecessary) brackets. This parameter is created by sending the message green to the Class Color. So in a Browser find Class Morph, on the instance side you will find the message color: and if you find Class Color you will find the message green on the class side" Herbert mailto:[hidden email] |
Free forum by Nabble | Edit this page |