Re: [Newbies] Exemple of pattern

2006-06-22 Thread Giovanni Corriga
Il giorno mer, 21/06/2006 alle 14.07 +0200, Mathieu SUEN ha scritto:
 Hi,
 
 I was wondering were I can find some concret exemple of Decorator
 pattern in squeak.

In Squeak 3.8, look at the FlashFileStream class.

 And also:Adapter(I don't really understand the use of it)

This I don't know.

 Abstract Factory

I'm not sure, but for abstract factory maybe you could look into
ToolBuilder for Squeak 3.9.

 Builder

The GoF book cites Parser, ClassBuilder as examples of the Builder
pattern.

 and Factory methode

The GoF book cites BehaviorparserClass as an example of this pattern.

Giovanni

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Exemple of pattern

2006-06-22 Thread stéphane ducasse

In fact it would be really nice to have a list of the pattern usage.

Stef




Il giorno mer, 21/06/2006 alle 14.07 +0200, Mathieu SUEN ha scritto:

Hi,

I was wondering were I can find some concret exemple of Decorator
pattern in squeak.


In Squeak 3.8, look at the FlashFileStream class.


And also:Adapter(I don't really understand the use of it)


This I don't know.


Abstract Factory


I'm not sure, but for abstract factory maybe you could look into
ToolBuilder for Squeak 3.9.


Builder


The GoF book cites Parser, ClassBuilder as examples of the Builder
pattern.


and Factory methode


The GoF book cites BehaviorparserClass as an example of this  
pattern.


Giovanni

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Exemple of pattern

2006-06-22 Thread Mathieu SUEN

Yes, :-)

Do Roel Wuyts can do something for us?
;-)


2006/6/22, stéphane ducasse [EMAIL PROTECTED]:

In fact it would be really nice to have a list of the pattern usage.

Stef



 Il giorno mer, 21/06/2006 alle 14.07 +0200, Mathieu SUEN ha scritto:
 Hi,

 I was wondering were I can find some concret exemple of Decorator
 pattern in squeak.

 In Squeak 3.8, look at the FlashFileStream class.

 And also:Adapter(I don't really understand the use of it)

 This I don't know.

 Abstract Factory

 I'm not sure, but for abstract factory maybe you could look into
 ToolBuilder for Squeak 3.9.

 Builder

 The GoF book cites Parser, ClassBuilder as examples of the Builder
 pattern.

 and Factory methode

 The GoF book cites BehaviorparserClass as an example of this
 pattern.

   Giovanni


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Exemple of pattern

2006-06-22 Thread Roel Wuyts

I can sing and dance :-)

Given more time I could even try to detect you all kinds of pattern  
instances, but for that we'd need to port Soul to Squeak again.


For the Adaptor thing, any wrapper class will do. There have to exist  
such classes in Squeak. Doing a search for classes that ends in  
Wrapper will probably yield some examples.


On 22 Jun 2006, at 10:36, Mathieu SUEN wrote:


Yes, :-)

Do Roel Wuyts can do something for us?
;-)


2006/6/22, stéphane ducasse [EMAIL PROTECTED]:

In fact it would be really nice to have a list of the pattern usage.

Stef



 Il giorno mer, 21/06/2006 alle 14.07 +0200, Mathieu SUEN ha  
scritto:

 Hi,

 I was wondering were I can find some concret exemple of Decorator
 pattern in squeak.

 In Squeak 3.8, look at the FlashFileStream class.

 And also:Adapter(I don't really understand the use of it)

 This I don't know.

 Abstract Factory

 I'm not sure, but for abstract factory maybe you could look into
 ToolBuilder for Squeak 3.9.

 Builder

 The GoF book cites Parser, ClassBuilder as examples of the Builder
 pattern.

 and Factory methode

 The GoF book cites BehaviorparserClass as an example of this
 pattern.

   Giovanni


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners



___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Exemple of pattern

2006-06-22 Thread Mathieu SUEN

2006/6/22, Roel Wuyts [EMAIL PROTECTED]:

I can sing and dance :-)

Given more time


Of course! No problem.



For the Adaptor thing, any wrapper class will do. There have to exist
such classes in Squeak. Doing a search for classes that ends in
Wrapper will probably yield some examples.


Ok I will searche for it. .. But the Decorator pattern use also this
convention. Don't he?
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Exemple of pattern

2006-06-22 Thread Roel Wuyts
Yes, I mean, I didn't want to say that every wrapper class is an  
Adaptor. Just that in my experience, if you want to find examples of  
adaptors, looking through wrapper classes might yield you some examples.


And indeed, up until a certain point adaptors and decorators might  
look similar. Adaptors typically (but not necessarily!) translate  
interfaces (e.g. they implement methods that a client class expects).  
Or it might happen that they adapt semantics (in which case they will  
implement methods with the same signature but adapt the behaviour to  
be consistent with what a client expects). Decorators typically  
override methods. Therefore the client cannot make the difference  
between a non-decorated and a decorated object, and just sends a  
polymorphic method.


Note that these are just very brief summaries of the much more  
extensive discussions found in the design pattern book...


On 22 Jun 2006, at 14:40, Mathieu SUEN wrote:


2006/6/22, Roel Wuyts [EMAIL PROTECTED]:

I can sing and dance :-)

Given more time


Of course! No problem.



For the Adaptor thing, any wrapper class will do. There have to exist
such classes in Squeak. Doing a search for classes that ends in
Wrapper will probably yield some examples.


Ok I will searche for it. .. But the Decorator pattern use also this
convention. Don't he?
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners



___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] installation question

2006-06-22 Thread Thomas Keller
Hi,I've just installed Squeak3.8-MacOS-Full and I noticed that SqueakV3.sources has a date modified of Feb 5, 2040, 9:28 PM I know Squeak is ahead of its time and I'm really impressed, but don't know what it means. Should I worry?
-- Tom"Ecrasez l'Infame!" -- Voltaire
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] EmphasizedMenu question

2006-06-22 Thread Thomas Keller
Greetings,I'm working through http://www.maartensz.org/computing/squeak/Helps/Environment/Workspaces4.htm and 

(EmphasizedMenu
selections: #('bold' 'plain' 'italic' 'struckout' 'plain' 'nice menu!') 
emphases: #(bold plain italic struckOut plain bold))
startUpGives me the MessageNotUnderstood error:doesNotUnderstand: aMessage  Handle the fact that there was an attempt to send the given message to the receiver but the receiver does not understand this message (typically sent from the machine when a message is sent to the receiver and no method is defined for that selector).
 Testing: (3 activeProcess) (Preferences autoAccessors and: [self tryToDefineVariableAccess: aMessage])  ifTrue: [^ aMessage sentTo: self]. MessageNotUnderstood new   message: aMessage;
  receiver: self;  signal. ^ aMessage sentTo: self.Can someone explain what I've done wrong? (currContext := only)-- Tom"Ecrasez l'Infame!" -- Voltaire
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Demystifying most Smalltalk’s don 't directly support multiple inheritance

2006-06-22 Thread Klaus D. Witzel

List,

haven't you heard that Smalltalk and Squeak do not directly support  
multiple inheritance, time and again? But that Perl, Python and Ruby do  
(to some extent)?

- http://www.google.com/search?q=python+ruby+multiple+inheritance

Well, that is not the case for Smalltalk since the time that VMs are  
implemented by using the specs of the Blue Book.


I have attached a small .st file which demonstrates that the *unchanged*  
VM *must* support multiple inheritance (for message sends), or else it  
won't work properly. It's a matter of view on what the VM does for you :-D


With the exception of support code for exceptions [pun intended] the  
attached examples work on VMs which implement the super send from the Blue  
Book.


The first example demonstrates that multiple inheritance works; in this  
example it is also checked that the requesting method qualifies (that the  
instances qualify is checked at fileIn time).


The second example does a message tally and shows that there is less than  
50% overhead when possible walkbacks are guarded at every multiple  
inheritance message send.


The third example employs the existing method cache of the VM (the  
original Squeak VM) for multiple inheritance message sends and thus  
minimizes the overhead to less than 5% (and the demo is written in .st  
code :-)


Again, this all exists *unchanged* for decades. It only had to be brought  
to the surface?


---

I would be very interested to see if my examples run on other platforms  
and VMs, please post your experience. Thank you.


It'd be equally interesting if the approach had been used before.

/Klaus

Multiple-Inheritance.st
Description: Binary data
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] how to create an object (of a selection of classes)

2006-06-22 Thread Jeroen van Hilst
Best List,

Im very curious to the the 'smalltalk way' to write the following code:

| shape morph |
(2 atRandom == 1)
ifTrue: [shape := RectangleMorph]
ifFalse: [shape := EllipseMorph].
morph := shape new.

I've tried something like:

(#(EllipseMorph RectangleMorph) at: (2 atRandom)) new.

But thats too silly ? Is there some connection to get a class from a symbol
? Or is that the wrong direction ?


Thanks in advance,


- Jeroen - aspiring squeaker.



___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] how to create an object (of a selection of classes)

2006-06-22 Thread Benjamin Schroeder


On Jun 22, 2006, at 7:07 PM, Jeroen van Hilst wrote:


I've tried something like:

(#(EllipseMorph RectangleMorph) at: (2 atRandom)) new.

But thats too silly ? Is there some connection to get a class from  
a symbol

? Or is that the wrong direction ?


I like your approach. I think using the #() array here will give you  
Symbols - but you can use a literal array with curly braces -


{EllipseMorph. RectangleMorph}

to get the actual classes. (Note the period between the array  
elements.) This form of literal evaluates its expressions and uses  
the results to build the array. it's also useful when you want to  
build an array out of some variables, or have some short math or  
something to do.


Just to mention it, you can also get to a class from a Symbol by  
doing something like


Smalltalk at: #EllipseMorph

if that's needed in your situation.

I don't know if you saw, but collections also respond to #atRandom  
directly, so you could do


{EllipseMorph. RectangleMorph} atRandom new.

Hope this helps,
Benjamin Schroeder

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners