Object factory... Is that how it's called??

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

Object factory... Is that how it's called??

Michel Calonne
Hello,
I'm quite new to smalltalk, and I'm developping on Squeak. As part of my studies I must create a serializer, wich translates an object to a xml file, and vice versa.
My question is, how should I do to create an instance of, for example, a 'toto' class (yes, it is a String, readen from the xml file)??
If anyone can help me, it would be great! Thanks by advance!

PS: Mr Ducasse, c'est ma question bonus ça!

Reply | Threaded
Open this post in threaded view
|

Re: Object factory... Is that how it's called??

cbeler


Michel Calonne a écrit :

>Hello,
>I'm quite new to smalltalk, and I'm developping on Squeak. As part of my studies I must create a serializer, wich translates an object to a xml file, and vice versa.
>  
>
you should have a look at SIXX which is a XML serializer for squeak and
you'll probably find ideas in it...

>My question is, how should I do to create an instance of, for example, a 'toto' class (yes, it is a String, readen from the xml file)??
>If anyone can help me, it would be great! Thanks by advance!
>  
>
otherwise maybe:
(Smalltalk at: 'toto' asSymbol ifAbsent:[^nil]) to get the class from a
String

>PS: Mr Ducasse, c'est ma question bonus ça!
>  
>
+ one point ? :)

Cédrick

Reply | Threaded
Open this post in threaded view
|

Re: Object factory... Is that how it's called??

Dominique Dutoit-2
In reply to this post by Michel Calonne
SIXX provides a simple solution to serialise and deserialise XML  
objects. Check the website.

http://www.mars.dti.ne.jp/~umejava/smalltalk/sixx/index.html

> Object factory... Is that how it's called??
> To: [hidden email]
> Message-ID:
> <[hidden email]>
> Content-Type: text/plain; charset="iso-8859-15"
>
> Hello,
> I'm quite new to smalltalk, and I'm developping on Squeak. As part  
> of my studies I must create a serializer, wich translates an object  
> to a xml file, and vice versa.
> My question is, how should I do to create an instance of, for  
> example, a 'toto' class (yes, it is a String, readen from the xml  
> file)??
> If anyone can help me, it would be great! Thanks by advance!
>
> PS: Mr Ducasse, c'est ma question bonus ça!


Reply | Threaded
Open this post in threaded view
|

Re: Object factory... Is that how it's called??

Bert Freudenberg-3
In reply to this post by cbeler
Am 08.05.2006 um 15:25 schrieb Cédrick Béler:

> Michel Calonne a écrit :
>
>> My question is, how should I do to create an instance of, for  
>> example, a 'toto' class (yes, it is a String, readen from the xml  
>> file)??
>>
> otherwise maybe:
> (Smalltalk at: 'toto' asSymbol ifAbsent:[^nil]) to get the class  
> from a String

Better yet:

        Smalltalk classNamed: 'Toto'

(btw, regular class names are always capitalized)

- Bert -


Reply | Threaded
Open this post in threaded view
|

Re: Object factory... Is that how it's called??

stéphane ducasse-2
In reply to this post by Michel Calonne

On 8 mai 06, at 13:18, Michel Calonne wrote:

> Hello,
> I'm quite new to smalltalk, and I'm developping on Squeak. As part  
> of my studies I must create a serializer, wich translates an object  
> to a xml file, and vice versa.
> My question is, how should I do to create an instance of, for  
> example, a 'toto' class (yes, it is a String, readen from the xml  
> file)??
> If anyone can help me, it would be great! Thanks by advance!

(Smalltalk at: #Toto) new

>
> PS: Mr Ducasse, c'est ma question bonus ça!

Good but you need more than one question :)
But you saw these squeakers are nice and they already replied to you  
without RTFM kinds of absurd and aggressive
behavior.
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Object factory... Is that how it's called??

stéphane ducasse-2
In reply to this post by cbeler

On 8 mai 06, at 15:25, Cédrick Béler wrote:

>
>
> Michel Calonne a écrit :
>
>> Hello,
>> I'm quite new to smalltalk, and I'm developping on Squeak. As part  
>> of my studies I must create a serializer, wich translates an  
>> object to a xml file, and vice versa.
>>
> you should have a look at SIXX which is a XML serializer for squeak  
> and you'll probably find ideas in it...
>
>> My question is, how should I do to create an instance of, for  
>> example, a 'toto' class (yes, it is a String, readen from the xml  
>> file)??
>> If anyone can help me, it would be great! Thanks by advance!
>>
> otherwise maybe:
> (Smalltalk at: 'toto' asSymbol ifAbsent:[^nil]) to get the class  
> from a String
>
>> PS: Mr Ducasse, c'est ma question bonus ça!
>>
> + one point ? :)

The deal was that if they ask questions on any squeaking mailing-list  
they get more credits :)