chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] Factory pattern


From: Carlos Pita
Subject: [Chicken-users] Factory pattern
Date: Sat, 23 Jun 2007 18:33:56 -0300

Hi folks,
I'm new to tinyclos. I've been playing a bit with it and there is something that still annoys me. All the examples I've seen uses the initialize generic with initargs (usually in combination with the convenient initialize-slots) to initialize instances. Well, I felt that initialize-slots is there just because working with a plain list of args is not too comfortable for a constructor, so in practice initialize is more or less confined to work as a slot initializer. But then I think that this kind of constructor exposes every slot to the client, which is all against encapsulation. This can be solved easily defining different factory procedures, which encapsulate the call to make themselves. But I can't find code or advices regarding the use of this pattern with tinyclos. Is this common practice? Is there another recommended way to define proper constructors on top of make+initialize that encapsulate instance initialization?
Thank you in advance.
Cheers,
Carlos

reply via email to

[Prev in Thread] Current Thread [Next in Thread]