A Design Pattern Question for Functional Programers

2012-04-18 Thread Xah Lee
Functional programing is getting the presses in mainstream. I ran across this dialogue where a imperative coder was trying to get into functional programing: A: What are the design patterns that help structure functional systems? B: Design patterns? Hey everyone, look at the muggle try to get

Re: observer pattern question #1 (reference to subject)

2008-05-08 Thread castironpi
On May 8, 4:57 pm, Alan Isaac <[EMAIL PROTECTED]> wrote: > Ville M. Vainio wrote: > > in case of stocks, you are probably monitoring several > > stock objects, so the stock should probably pass itself to > > the observer > > OK.  This is related to my question #2 (in a separate > > thread), where I

Re: observer pattern question #1 (reference to subject)

2008-05-08 Thread Alan Isaac
Ville M. Vainio wrote: in case of stocks, you are probably monitoring several stock objects, so the stock should probably pass itself to the observer OK. This is related to my question #2 (in a separate thread), where I'd also appreciate your comments. analogous to a typical U

Re: observer pattern question #1 (reference to subject)

2008-05-08 Thread Ville M. Vainio
Alan Isaac <[EMAIL PROTECTED]> writes: > the following: "OK, here's the pattern, now your listener > wants to know the event source, do not ask something new the > subject to respond to that need. That is unnecessary > coupling. Instead, just rewrite your listener to maintain > a reference to th

Re: observer pattern question #1 (reference to subject)

2008-05-08 Thread Alan Isaac
Alan Isaac <[EMAIL PROTECTED]> writes: Is anything lost by not maintaining this reference (other than error checking ...)? If I feel the observer needs access to the subject, what is wrong with just having the subject pass itself as part of the notification? Ville M. Vainio wrot

Re: observer pattern question #1 (reference to subject)

2008-05-08 Thread Ville M. Vainio
Alan Isaac <[EMAIL PROTECTED]> writes: > Is anything lost by not maintaining this reference (other > > than error checking ...)? If I feel the observer needs > > access to the subject, what is wrong with just having the > > subject pass itself as part of the notification? It reduces the number

observer pattern question #2 (notification chain)

2008-05-08 Thread Alan Isaac
I have two questions about the "observer pattern" in Python. This is question #2. (I'll put the other is a separate post.) Consider this standard example of the observer pattern in Python: http://en.wikipedia.org/wiki/Observer_pattern> Now suppose I have a variant. (I am not a programm

observer pattern question #1 (reference to subject)

2008-05-08 Thread Alan Isaac
I have two questions about the "observer pattern" in Python. This is question #1. (I'll put the other is a separate post.) Here is a standard example of the observer pattern in Python: http://en.wikipedia.org/wiki/Observer_pattern Contrast with this rather standard discussion: http:/

Re: Pattern question

2005-07-09 Thread cantabile
Scott David Daniels a écrit : > cantabile wrote: > >> bruno modulix a écrit : >> >>> You may want to have a look at the Factory pattern... >>> ... demo of class Factory ... > > > Taking advantage of Python's dynamic nature, you could simply: > # similarly outrageously oversimplified dummy ex

Re: Pattern question

2005-07-08 Thread Scott David Daniels
cantabile wrote: > bruno modulix a écrit : >>You may want to have a look at the Factory pattern... >> ... demo of class Factory ... Taking advantage of Python's dynamic nature, you could simply: # similarly outrageously oversimplified dummy example class Gui(object): def __init__

Re: Pattern question

2005-07-08 Thread cantabile
bruno modulix a écrit : > You may want to have a look at the Factory pattern... > > # outrageously oversimplified dummy exemple > class Gui(object): >def __init__(self, installer): > self.installer = installer > > class PosixGui(Gui): >pass > > class Win32Gui(Gui): >pass > > c

Re: Pattern question

2005-07-08 Thread bruno modulix
cantabile wrote: > Hi, > > I'm trying to write a small installer for a server. But this program > should be able to run in the future under heterogenous environments and > os (at least linux/windows). I mean, the install will be done either in > text mode or curses or gtk or tk, either in debian o

Pattern question

2005-07-07 Thread cantabile
Hi, I'm trying to write a small installer for a server. But this program should be able to run in the future under heterogenous environments and os (at least linux/windows). I mean, the install will be done either in text mode or curses or gtk or tk, either in debian or windows 2000 and so on...