Question for newbie

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Question for newbie

Steve Bleeke
I read another question about a root class not showing on the configuration list for entry points even though it had a canBeRoot method.
 
The answer was to place the canBeRoot method on the class side.  What does class side mean?
 
Thanks.

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Question for newbie

Randal L. Schwartz
>>>>> "Steve" == Steve Bleeke <[hidden email]> writes:

Steve> I read another question about a root class not showing on the
Steve> configuration list for entry points even though it had a canBeRoot
Steve> method.  The answer was to place the canBeRoot method on the class
Steve> side.  What does class side mean?


YourClass thisIsAClassSideMessage

x := YourClass new.
x thisIsAnInstanceSideMessage

In the gui, pay attention to whether you have "class" or "instance"
selected in the pane below the class name (usually second column).


--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[hidden email]> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Question for newbie

Claus Kick
In reply to this post by Steve Bleeke
Steve Bleeke wrote:
> I read another question about a root class not showing on the configuration list for entry points even though it had a canBeRoot method.
>
> The answer was to place the canBeRoot method on the class side.  What does class side mean?
>

Everything in a Smalltalk system is an object.

Every object is an instance of a class.

The instance side defines behaviour for every object instance.

The class side provides general valid behavior, like whether a component
canBeRoot for a Seaside application.

The common example is to have a Class Car, which has a class method
#needsFuel which returns true.

It has an instance method called #move: which manipulates the tank
filling of the car, decrement by moving, depending on whether an object
of class Car needs fuel or not:

Car >> move: aDistance

self class needsFuel
ifTrue:[
fuel := fuel - aDistance //10.
].


Now, you create an instance of Car.

car := Car new.

car move: 100.

So the car has moved 100 somethings, which means the tank of that car
has been depleted a bit.

Now you create a new instance of Car.

car2 := Car new.

car2 will still have a full tank.


Now, if you have a Class called "PerpetuumMobile", it is next to the
Class Car, below the same parent called "Machine". This class answers
false to #needsFuel, but has the same method #move:

PerpetuumMobile >> move: aDistance

self class needsFuel
ifTrue:[
fuel := fuel - aDistance //10.
].

So, moving an instance of PerpetuumMobile will not decrement the tank
filling.

Of course, in reality, the move: method will be implemented in the class
Machine.

I hope this does make some sense to you.

Suggested readings: Object-Oriented Programming, Polymorphism, Inheritance.

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Question for newbie

Steve Bleeke
In reply to this post by Randal L. Schwartz
Thanks, I don't think that distinction was mentioned in any of the tutorials
that I have been through including Squeak by Example.

----- Original Message -----
From: "Randal L. Schwartz" <[hidden email]>
To: "Steve Bleeke" <[hidden email]>
Cc: <[hidden email]>
Sent: Friday, January 09, 2009 11:51 AM
Subject: Re: [Seaside] Question for newbie


>>>>>> "Steve" == Steve Bleeke <[hidden email]> writes:
>
> Steve> I read another question about a root class not showing on the
> Steve> configuration list for entry points even though it had a canBeRoot
> Steve> method.  The answer was to place the canBeRoot method on the class
> Steve> side.  What does class side mean?
>
>
> YourClass thisIsAClassSideMessage
>
> x := YourClass new.
> x thisIsAnInstanceSideMessage
>
> In the gui, pay attention to whether you have "class" or "instance"
> selected in the pane below the class name (usually second column).
>
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777
> 0095
> <[hidden email]> <URL:http://www.stonehenge.com/merlyn/>
> Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
> See http://methodsandmessages.vox.com/ for Smalltalk and Seaside
> discussion
>

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Question for newbie

David Mitchell-10
In Squeak by Example, it is explained in Chapter 5 under the heading

The Instance Side and the Class Side

On Fri, Jan 9, 2009 at 11:13 AM, Steve Bleeke <[hidden email]> wrote:
Thanks, I don't think that distinction was mentioned in any of the tutorials that I have been through including Squeak by Example.

----- Original Message ----- From: "Randal L. Schwartz" <[hidden email]>
To: "Steve Bleeke" <[hidden email]>
Cc: <[hidden email]>
Sent: Friday, January 09, 2009 11:51 AM
Subject: Re: [Seaside] Question for newbie



"Steve" == Steve Bleeke <[hidden email]> writes:

Steve> I read another question about a root class not showing on the
Steve> configuration list for entry points even though it had a canBeRoot
Steve> method.  The answer was to place the canBeRoot method on the class
Steve> side.  What does class side mean?


YourClass thisIsAClassSideMessage

x := YourClass new.
x thisIsAnInstanceSideMessage

In the gui, pay attention to whether you have "class" or "instance"
selected in the pane below the class name (usually second column).


--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[hidden email]> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Stuck in the tutorial newbie

Steve Bleeke
In reply to this post by Randal L. Schwartz
I copied what you wrote into my method which looks the same as it did
before:

renderTextInputOn: html

html textInput
 on: #email of: self;
 value: ''.
html space.

same result

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Stuck in the tutorial newbie

Philippe Marschall
2009/1/9 Steve Bleeke <[hidden email]>:
> I copied what you wrote into my method which looks the same as it did
> before:
>
> renderTextInputOn: html
>
> html textInput
> on: #email of: self;
> value: ''.

You shouldn't send #value: if you already send #on:of:. That's however
not likely to cause your problem.

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside