Yes, I would agree that the book gives insight into OO design through the patterns. Talk about a fog, when I first started learning about patterns a couple of...
Brian, when you say: "These would be things like the open/closed principle, strategic closure, information hiding, one rule one place (or one implementation...
Over on the SeaJUG list they've been talking about Singleton and Double-Checked Locking not being reliable in some JRE's. But, given that Java allows for...
Scott L. Bain
slbain@...
Mar 15, 2002 8:05 pm
165
Have you heard that your code below for instantiating and returning a singleton is bad? I had always heard that your example is one way around the DCL idiom...
No, Tom, nobody has given me any criticisms of this approach, it's just not what I'd seen in the pattern books and so forth, and it was not brought up as a...
Scott L. Bain
slbain@...
Mar 16, 2002 3:22 am
168
Hi, I met a practical problem when applying Decorator pattern to my project. Thank you very much for your attention. Let's say I have an abstract Component...
Two questions: 1) You state that Component is an interface, then you talk about its method implementation. I'm sure that's not what you mean, but some...
Scott L. Bain
slbain@...
Mar 19, 2002 5:54 pm
170
Thank you for your response. 1) Let me clarify Component is an interface. ConcreteComponent is the concrete subclass. Did I mention any implementation for...
interface Component{ public void goo(); public void foo(); } class ConcreteComponent implements Component{ public void goo(){ System.out.println("this is...
Your first option in the decorator is correct. Your decorator needs a constructor that takes a Component implementation, of course. That said, the goo()...
Scott L. Bain
slbain@...
Mar 19, 2002 7:16 pm
173
I can not change the fact that goo() is public. I have some existing code with foo() and goo() defined in Component and implemented in ConcreteComponent and...
Yes. I omitted that in the code but the Decorator's constructor should be sth as normal as: public Decorator(Component c){ this.component=c; } My logic is, I...
Understood. I think we have to get back to motivations here. What's the goal? Do you want to be able to decorate both foo() and goo(), or are you only wanted...
Scott L. Bain
slbain@...
Mar 19, 2002 8:48 pm
176
It starts with a requirement to add new features to existing classes, there will be 5 or 6 new features (and their combinations) I am aiming at. Certainly...
Hi, here is an interesting response for my same question posted on newsgroup comp.object: " Decorators don't do what you want. Once the decorator has...
Hello everyone, Can anyone explain that whats the reason of having a singleton object....why is there a need of it...cant we have the need satisfied by simply...
Farhan, That's a good question. Why create a single instance when you can just access a static class's methods and member variables? Perhaps implementation...
Some quick reasons you might use a Singleton rather than static methods on a class: 1) You want polymorphism. You want one class to hold a reference to ...
Scott L. Bain
slbain@...
Mar 21, 2002 5:22 pm
181
Farhan, Welcome to the list! (And what a "happy" name you have.) You evidently were not here when we last discussed this in early February. I have attached ...
For those of you in california, check out http://www.netobjectives.com/pr_future.htm I am doing a series of talks in both the bay area and in LA. These talks...
I may be wrong, but I think you should decorate the goo() method first, and then, in another decorator you should decorate the foo() method. Does this solve...
I urge you to check out Yahoo's new marketing policy: http://help.yahoo.com/help/us/privacy/privacy-23.html In particular, note this statement: In addition, we...
Here's a question I got off list: I am an owner of your book "Design patterns explained " and have a question for you. I like the Composite design patterns to...
... This is another reason factories are useful. Somehow you need to translate the internal composite structure to the external RDBMS and vice versa. I set...
Another option would be to use a data-binding framework. This allows you to marshal a graph of objects (in this case, a composite, but it could be any group...
Scott L. Bain
slbain@...
Apr 5, 2002 3:17 pm
188
If you're using the J2EE, composite & whole-part hierarchies, then CMP 2.0 is a solid way to go because it allows you to declaratively describe the...
Tom: No apology necessary for the recommendation of the core j2EE patterns book. First of all, it's a great book (serves a different purpose than mine)....
Hi: I just reading your DPExplained. I think it's a great book which could be expanded more in detail :) You mentioned about encapsulating at class-level via...