Hi:
I want to know when we need to use the abstract factory pattern.
Here is an example,I want to know if it is necessary.
The UML
THe above is the abstract factory pattern, it is recommended by my classmate.
THe following is myown implemention. I do not think it is necessary to use the pattern.
And the following is some core codes:
...
I am learning STL and design patterns .
i wanted to know is there any document or link that explains how design patterns are implemented in STL
i did the google but not able to get much data
...
I create a lot of web applications that deal with different groups of users creating and editing data.
Usually there are requirements regarding users and what actions they can or cannot perform on the data depending on who they are and what state the data is in.
Should I create a single form for all users to use and build permission bo...
i know that in Java you can use their built-in APIs for design pattern.
eg. if you want to use the observer pattern, you just have to extend your Subject class with the Observable class.
is this possible for PHP? are there any libraries for the design patterns ready to use. in this way you don't have to reinvent the wheel and you also ...
I'm trying to understand the factory design pattern.
I don't understand why it's good to have a middleman between the client and the product (object that the client wants).
example with no factory:
$mac = new Mac();
example with a factory:
$appleStore = new AppleStore();
$mac = $appleStore->getProduct('mac');
How does the factory...
I read a lot of books about how to code right and usually they are talking about all these techniques from a point of view I can't understand.
E.g. lets consider the singleton pattern:
I'm restricting so the class can only be instantiated once, but since it's only me creating the application, if I know that the class only should be ins...
Singletons are so often said to be a bad design choice, so how should you design an application when you want to avoid them?
...
I have a little problem that involves modeling a state machine.
I have managed to do a little bit of knowledge engineering and 'reverse engineer' a set of primitive deterministic rules that determine state as well as state transitions.
I would like to know what the best practices are regarding:
How to rigorously test my states and st...
Sorry my title is not great, this is my first real punt at moving 100% to OO as I've been procedural for more years than I can remember. I'm finding it hard to understand if what I'm trying to do is possible. Depending on people's thoughts on the 2 following points, I'll go down that route.
The CMS I'm putting together is quote small, h...
I was studying Decorator pattern of GOF. It seems to me somehow complecated.
So, please help me understand "Decorator Pattern"? Could you give me an example of this is real world?
...
Does anyone know of a website where I can found a collection of design patterns exercises?
Thanks in advance.
...
According to Presentation Model notes by Martin Fowler and also on MSDN documentation about Presentation Model, it is explained that the Presentation Model Class should be unaware of the UI class and similarly Business Model Class should be unaware of the Presentation Model class.
The UI should databind extensively to the Presentation ...
I want to write a generic singleton with an external constructor. In other words the constructor can be modified. I have 2 designs in my mind but I don't know whether they are practical or not.
First one is to enforce derived class' constructor to be non-public but I do not know if there is a way of it?
Second one is to use a delegate ...
After doing some reading about the Module Pattern, I've seen a few ways of returning the properties which you want to be public.
One of the most common ways is to declare your public properties and methods right inside of the "return" statement, apart from your private properties and methods. A similar way (the "Revealing" pattern) is ...
One of the main things I wanted to achieve in my experimental programming language was: When errors occur (Syntax, Name, Type, etc.) keep the program running, no matter how serious or devastating it is.
I know that this is probably very bad, but I just wanted something that doesn't kill itself on every error - I find it interesting what ...
The classical strongly typed MVP pattern looks like this in Scala:
trait IView { }
trait Presenter[View <: IView] { // or have it as an abstract type member
val view : View
}
case class View1(...) extends IView { ... }
case object Presenter1 extends Presenter[View1] {
val view = View1(...)
}
Now, I wonder if there is any nice...
What is the best way to model MVC Areas for my Application? Can I manage these Areas dynamically? What is the best usage of them?
Thanks
...
Consider web (MVC, for example Rails) application for multiple clients as a service.
How to design this?
one application instance per client? (+ one database per client)
one instance for all clients (+ one database for all clients)
Former one is simple, but... "inefficient". How about the latter? (best practices, design patterns) H...
Hi,
I'm trying to figure out how to design a small application more elegantly, and make it more resistant to change.
Basically it is a sort of project price calculator, and the problem is that there are many parameters that can affect the pricing. I'm trying to avoid cluttering the code with a lot of if-clauses for each parameter, but ...
Requirements:
multiple sources of input (social media content) into a system
multiple destinations of output (social media api's)
sources and destinations WILL be added
some pseudo:
IContentProvider contentProvider = context.getBean("contentProvider");
List<Content> toPost = contentProvider.getContent();
for (Content c : toPost) {
...