[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: prototype design pattern

Berger, Daniel

7/12/2006 2:43:00 PM



> -----Original Message-----
> From: ara.t.howard@noaa.gov [mailto:ara.t.howard@noaa.gov]
> Sent: Wednesday, July 12, 2006 8:27 AM
> To: ruby-talk ML
> Subject: prototype design pattern
>
>
>
> anyone know of a good impl for ruby?
>
> regards.
>
> -a

Hm, it's not at
http://wiki.rubygarden.org/Ruby/page/show/ExampleDesignPatt...

Anyway, it looks to me like some combination of .clone plus a factory.
I'm not sure there's any real savings in Ruby to doing things this way,
but I'd be happy to be proved wrong.

Regards,

Dan


This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and destroy
all copies of the communication and any attachments.

6 Answers

Ara.T.Howard

7/12/2006 3:08:00 PM

0

Trans

7/13/2006 2:37:00 AM

0


ara.t.howard@noaa.gov wrote:
>
> DB = Prototype.new{
> host 'localhost'
> port 4242
>
> def connect() 'do something' end
>
> def inspect() [host, port].join ':' end
> }

Why no go the extra step?

DB = Prototype.new{
host 'localhost'
port 4242

connect does{ 'do something' }

inspect does{ [host, port].join ':' }
}

T.


Ara.T.Howard

7/13/2006 2:27:00 PM

0

Christian Neukirchen

7/13/2006 7:29:00 PM

0

transfire@gmail.com writes:

> ara.t.howard@noaa.gov wrote:
>>
>> DB = Prototype.new{
>> host 'localhost'
>> port 4242
>>
>> def connect() 'do something' end
>>
>> def inspect() [host, port].join ':' end
>> }
>
> Why no go the extra step?
>
> DB = Prototype.new{
> host 'localhost'
> port 4242
>
> connect does{ 'do something' }
>
> inspect does{ [host, port].join ':' }
> }

Why not even this:

connect { 'do something' }

inspect { [host, port].join ':' }

> T.
--
Christian Neukirchen <chneukirchen@gmail.com> http://chneuk...

Ara.T.Howard

7/13/2006 8:04:00 PM

0

Trans

7/14/2006 1:16:00 AM

0


Christian Neukirchen wrote:

> Why not even this:
>
> connect { 'do something' }
>
> inspect { [host, port].join ':' }

Sweet and fine! My, oh my, it's looking like a paradigm.

T.