Nate Schutta<br />Coauthor of <a href="http://www.amazon.com/exec/obidos/redirect?link_code=ur2&camp=1789&tag=ntschuttacom-20&creative=9325&path=tg/detail/-/1590595823/qid=1127567332/sr=8-1/ref=pd_bbs_1?v=glance%26s=books%26n=507846" target="_blank" rel="nofollow">Foundations of Ajax</a><br />My blog: <a href="http://www.ntschutta.com/jat/" target="_blank" rel="nofollow">Just a Thought</a>
"Write beautiful code; then profile that beautiful code and make little bits of it uglier but faster." --The JavaPerformanceTuning.com team, Newsletter 039.
Originally posted by Junilu Lacar:
Not really a vote off but I really wish people would stop using "Value Object" instead of Transfer Object.
"Write beautiful code; then profile that beautiful code and make little bits of it uglier but faster." --The JavaPerformanceTuning.com team, Newsletter 039.
Greg Ostravich - SCPJ2
I think Composite has multiple important uses, not the least of which is a valuable teaching aid and a mnemonic for understanding how one kind of object can or should contain specializations of itself.Originally posted by David Hibbs:
These things said, high on my list to vote off would be...
Composite -- isn't this just aggregation/composition? Do we really need to describe this as a pattern ?!?! Mediator -- This is either where business logic goes or a good place for a strategy. When was the last time you saw this term in code??? Memento -- Hibernate, BMP, CMP... who needs a Memento?
Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Originally posted by Greg Ostravich:
I don't know what pattern I'd vote off, but I'm not sure I'd get rid of Composite. It's one of the few patterns that was simple to understand and recognize.
I think the value in Composite is that if you recognize that Structural Pattern than you have some 'gimmes' in terms of Behavioral patterns to walk that structure. Knowing you have a Composite, you may decide to use the Visitor and/or Iterator pattern.
There's my $.02 -
Cheers, Sathya Srinivasan - SCJP 1.2, SCWCD 1.2, SCMAD 1.0
Co-Author of Whizlabs SCMAD Certification Exam Simulator and SCMAD Exam Guide Book
Originally posted by Gerald Davis:
The decorator pattern is evil look what it has done to the Java io package man!, why is it unnecessary complicated. Is it doing the Irish Jig. It seems to me these classes below were once only states. States! you know the 'true' 'false' 'readable' and 'writeable'. Now they have mutated into object themselves bloatware city on steroids . I danna think Bill Gates could have done a better job himself.
Cheers, Sathya Srinivasan - SCJP 1.2, SCWCD 1.2, SCMAD 1.0
Co-Author of Whizlabs SCMAD Certification Exam Simulator and SCMAD Exam Guide Book
Originally posted by Gerald Davis:
The decorator pattern is evil look what it has done to the Java io package man!
why is it unnecessary complicated.
Imagine if we was to adopt this style to business modelling.
Employee = new EmployeesFromDepartment19FiredBeforeFebruary()
What a mess; composition gone mad, what kind of design pattern is this.
data = new AsciiInputStream(new FileInputStream("data.dat"));
So many classes; make them into functions? why would you do a daft thing like that for!!?
PrintStream FileOutputStream InputStreamReader OutputStream
WritableNonBufferedWindowsSocket
This is how IO should be in a sane man's language
s = OpenSocket(url, buffered=true, writable=true)
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Michael Ernest:
Now that Fowler is a little bored, he wants something sexy to emerge from all this patterns talk. Apparently that means for him pruning out the 'dead weight' from the catalog, the words that for him have fallen from favor.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Ilja Preuss:
So you'd like to reinvent buffering for every single kind of input? Stunning...
Originally posted by Ilja Preuss:
Sorry, that's simply not true.
Originally posted by Ilja Preuss:
First, he didn't at all say what he voted for; he just reported the result of a group vote.
Second, the patterns weren't "voted off" because they were boring, according to the report. Most where voted off because they didn't seem to be used frequently enough to be mentioned as a pattern (at least according to the participants). Factory Method explicitely was mentioned as having a confusing name, not as being useless.
Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
What do you mean by that? Do you have an example where Singleton provides multiple instances of a class? Sounds like a contradiction.Originally posted by Lanny Gilbert:
I know that I'd rename the Singleton pattern. Especially since I've seen it used so often to provide more than one instance of a class.
I don't know what I'd call it tho...
Maybe Single -but on occasion multiple- ton??![]()
IBM 286, SCJP, SCWCD, EIEIO
Originally posted by Michael Ernest:
Perhaps I'm reading too much between the lines
Factory could perhaps be better named
how will people learn or be informed that Factory and this new chosen word actually point to the same thing, etc., etc.? What standards body will emerge as an authority to arbitrate the passing of information, and then how will people come to know where to find this body's website, or what-have-you?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Gerald Davis:
OK, I over exaggerated a bit
data = new EmployeeFromDepartment19(new FiredBeforFebruary("data.dat"));
A little improvement but its still pants.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by David Hibbs:
The dislike of Singleton probably comes from the all-too-often incorrect implementations of it, coupled with it being a misnomer in clustered environments. That said, I'm still a fan of Singleton as a way of avoiding repeated creation of objects that are of a utilitarian nature such as configuration information. I say "Save the Singleton!"![]()
I don't hate Bridge, Interpreter or Adapter, but they could all be @deprecated and unified into a single pattern I like to call a Converter.
I don't understand the dislike of Factories.
More confusing to me than the term Factory is "Builder". Something fresh out of a factory is new and needs state set. But in what state does an object come from a Builder?
Composite -- isn't this just aggregation/composition?
Mediator -- This is either where business logic goes or a good place for a strategy. When was the last time you saw this term in code???
Memento -- Hibernate, BMP, CMP... who needs a Memento?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Co-Author of OCP Java SE 8 Programmer II Exam Guide
Originally posted by Junilu Lacar:
Not really a vote off but I really wish people would stop using "Value Object" instead of Transfer Object.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Elisabeth Freeman:
... which happened to coincide exactly with the patterns we wanted to cover in-depth with only one exception, ...
Originally posted by Elisabeth Freeman:
So I'm not sure I'd throw any off the island, but perhaps just make some go to the beach and relax![]()
Cheers, Sathya Srinivasan - SCJP 1.2, SCWCD 1.2, SCMAD 1.0
Co-Author of Whizlabs SCMAD Certification Exam Simulator and SCMAD Exam Guide Book
You probably mean that they should call TOs TOs, not that you shouldn't use VOs at all?![]()
SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
... which happened to coincide exactly with the patterns we wanted to cover in-depth with only one exception, ...
may we know which one?
Co-Author of OCP Java SE 8 Programmer II Exam Guide
Originally posted by Nicholas Cheung:
In fact, TO and VO are referring to the same thing?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Elisabeth Freeman:
Is there a way to do an official poll, or similar, to avoid too many posts and/or emails on the subject?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Co-Author of OCP Java SE 8 Programmer II Exam Guide
Originally posted by Ilja Preuss:
Aren't Interpreter and Adapter quite different in their structure? And in which way is Bridge a "Converter" at all?
"Write beautiful code; then profile that beautiful code and make little bits of it uglier but faster." --The JavaPerformanceTuning.com team, Newsletter 039.
Originally posted by Ilja Preuss:
If I ever get my BrainReader(TM) working, all I need to do is to implement a BrainInputStream. I don't need to care at all wether you actually want it to be buffered, wether you want to read it line by line, wether you want to convert it to a textual represenation (by wrapping it into a reader), or even use some decorator I'm not even aware of!
"Write beautiful code; then profile that beautiful code and make little bits of it uglier but faster." --The JavaPerformanceTuning.com team, Newsletter 039.
Originally posted by David Hibbs:
Just as long as you never implement a BrainWriter (TM). Even if you do, I REFUSE to ever pass you my BrainOutputStream. Or if I do, it will be permanently buffered to /dev/null.
![]()
Originally posted by Gerald Davis:
Brain(Stream=Input,Buffered=false,socket=true)
Does the same as
BrianInputBufferedSocked
BrianOutputBufferedSocket
BrianIntputSocket
BrianOutput
BrianOutputBuffered
BrianInputBuffered
bla bla bla bla
bla
This id doing my head in|
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by David Hibbs:
If you're a pattern purist, then yes--you're exactly right. The important issue, IMHO, is not so much the internal structure as that they take something in one form to another.
The difference between a "factory method" and a "simple creation method" is semantic.
Similarly, I think the difference between a builder and a factory that you mention is also semantic. Theoretically, yes, you can have more control over a builder. However, you can always implement a factory to provide more control.
Patterns should be named so that they inspire a thought of something everyone^M the majority of people is familiar with.
Actually not, no. With the Composite pattern, the trick is that the "parts" implement the same interface as the "whole" ... For example, when you call repaint on a JComponent, all its child components will be repainted, too, without you having to call their methods, too.
You can implement basic composition this way, too.
IMHO it's more of an extension of the basic concepts of aggregation and delegation. If people think it's a good one to keep around because it's an easy one to grasp, well, OK, but I don't think it needs its own name.
When did you last see a Mediator in your code?
If you want to keep it around, call it a Controller so it can be tied to MVC.
That's really what it's doing--controlling the interaction of pieces of the model and/or view.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Nicholas Cheung:
In fact, TO and VO are referring to the same thing? I feel it is just a change of the name, not a big deal indeed, isnt it?
Nick
Originally posted by Ilja Preuss:
So are you saying that in any situation you can use an Adapter, you could as well use an Interpreter? I don't get it...
Actually not, no. A creation method typically is static, whereas a Factory Method has to be an instance method, because it needs to be called polymorphically.
The *whole reason* for the existance of the Builder pattern is to give you finer control over how the product will get build!
Well, yes, that sounds like a good idea. It's somewhat dangerous to conclude that your personal thoughts are exactly the ones that match what the GoF had in mind, though, isn't it?
IMO, it needs its own name simply because it's so usefull. To me "we will implement a composition" has a very different meaning from "we will implement a Composite" - not a big difference in the actual code, but a huge difference in how the code will get used.
Why would you want to tie something so generic as Mediator to something as specialized as MVC?
Another common misconception: The responsibility of the Controller in the MVC pattern is *not* to mediate between the Model and the View (they are actually allowed to talk directly to one another), but to handle user input.
"Write beautiful code; then profile that beautiful code and make little bits of it uglier but faster." --The JavaPerformanceTuning.com team, Newsletter 039.
Originally posted by David Hibbs:
No, I'm saying that where you would use an Adapter, you could use a Converter. Where you would use an Interpreter, you could also use a Converter. Consider Converter as a superclass of both Adapter and Interpreter. The goal is similar (to make one object usable where it wouldn't normally be usable).
Sure, the GoF definition of a Factory works as you state, but the GoF doesn't have a simple creation method.
If we stick with "pure" GoF terms, a creation method then must be either a Factory or an Abstract Factory.
Open Source factory example: commons logging. @see LogFactory.getLog(getClass().getName())
Is this a factory or not?
Perhaps. Consider... every example I've seen of a Builder only provides a few options. Most times they are used exactly as in an example. So I have to make 3 calls to do with a builder what I could do in a factory -- or by specifiying a "creation method" that simply takes the parameters I desire. So it seems that I can collapse a builder to a factory.
I never claimed it matched what the GoF had in mind. The talk was of how to update the GoF patterns to what is commonly accepted -- I simply want to match the updated names to the updated patterns.
I just think if you want it to be a specific pattern that you should give it a distinct name. Newcomers to OO and patterns will inevitably become confused. Consider: A composite object is not the same as a Composite object. The difference is only capitalization if you read it. Hope you're not listening to this through a speech interpreter.
OK, to clarify. By "tie" I did not mean that Controller (my new name) would not exist without MVC. I simply meant that Controller could become a component of a larger pattern (MVC) which would aid in understanding MVC.
I never said that this was its sole role/responsibility. While what you say "(they are actually allowed to talk directly to one another)" is true, the Controller is also not only there to handle user input. It also selects the next view based on model operations(MVC Model 2) -- which puts it squarely in the Mediator role.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Nate Schutta:
After reading Martin Fowler's OOPSLA wrap up (http://martinfowler.com/bliki/OOPSLA2004.html) I couldn't help but wonder: what pattern would you vote off the island?
Author of <a href="http://www.amazon.com/exec/obidos/ASIN/0131177052/ref=jranch-20" target="_blank" rel="nofollow">Working Effectively with Legacy Code</a>
Originally posted by Michael Feathers:
I'd vote off Template Method. To me, it's not a pattern, it's just the typical result when you remove duplication in an inheritance hierarchy.
Originally posted by Michael Feathers:
I'd vote off Template Method. To me, it's not a pattern, it's just the typical result when you remove duplication in an inheritance hierarchy.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Ilja Preuss:
So what would your Converter pattern look like? I can't imagine it...
True. I'm using the definition from "Refactoring to Patterns", but I think I've already seen it before. Do you know of a definition of Creation Method that conflicts with this?
I don't understand this reasoning.
Certainly the term Factory Method is already defined by GoF, in a way that doesn't allow a Factory Method to be a simple static method. So it seems clear to me that if we mean a static method that creates things, we should use a different name for it...
A good example for the Builder pattern is PanelBuilder from the FormLayout library...
Well, I don't think that a MVC Controller really is the same as a Mediator
I'm mainly working on Swing applications nowadays, and there the *sole* responsibility of the Controller actually is to handle user input.
"Write beautiful code; then profile that beautiful code and make little bits of it uglier but faster." --The JavaPerformanceTuning.com team, Newsletter 039.
Don't get me started about those stupid light bulbs. |