~ Pratibha Malhotra<br /> <br />Sun Certified Java Programmer<br />SCEA 1.4 (In Progress)<br />~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />"Many of life's failures are people who did not realize how close they were to success when they gave up!!"
Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
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
Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
Originally posted by Vladas Razas:
Then HFDP speaks about simple factory, but points out that it is not a pattern.
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
Why isn't it a pattern?
Originally posted by Vladas Razas:
I am not sure. I got that impression from HFDP. As I understood what they said is: Factory Method, Abstract Factory and simple Factory. And simple
Factory is not a pattern. Maybe because it's not in GoF?
I think Factory Method is a case of Template Method. Implementation seems very much alike. Only intention differs.
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
I'd say Factory Method is a special case of Template Method. Abstract Factory is a special case of Strategy.
Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Aniruddha
Originally posted by Pradip Bhat:
Simple factory is also a pattern to me. It hides the creation of the object. Does Ilja agree?![]()
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 Vladas Razas:
In my opinion Facade is alike to Adapter. Is it pattern at all?
Can we scrap Singleton? Its almost anti-pattern now. At least in it's simpliest form = coupling, problems with inheritance.
P.S. Builder is a strange one, rare and complex. It's an exercise to come up with example of use.
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 Rick O'Shay:
Factory method returns an object based on a token:
RockFactory // Factory method
{
Rock getRock( Rock.Type type );
}
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
RockFactory // Factory method
{
Rock getRock( Rock.Type type );
}
LandscapeFactory // Abstract Factory
{
LandscapeFactory( LandscapeType type);
Rock getRock();
Bird getBird();
House getHouse();
}
Factory method returns an object based on a token:
Software is too expensive to build cheaply...