Hi all,
what I am trying to achieve is to have a persistent list of "undoable" changes on a persistent storage (database).
The architecture employs repositories for the domain objects and Unit of Work for transactions and for the final part (undo) I thought of using the command pattern. However, for me there seems no good solution how ...
I use the decorator pattern to describe Actions, and I would like to use those Actions in RPC calls
public abstract class Action implement Serializable
{
boolean isDecorated = false;
public Action() {} // default constructor for Serialization
}
public abstract class ActionDecorator extends Action
{
private Action _decora...
Hi,
I am using asp.net and c#.
I have a some classes. Some of the classes are having same methods insert, update and delete.
Each insert will insert different data to different table. (same for update and delete). What type of pattern can be applied for this kind of class.
please suggest.
...
When developing Java EE applications how do I separate Business Logic so it can be reused?
I inherited an application that is mostly Model 1. Business logic is located in JSPs, Servlets and DAO code.
I want to separate the business logic but I am confused by all of the frameworks etc. that exist.
I am looking into Hibernate with JPA ...
I'm trying to code an "undo" or "rollback" type scenario. Part of me thinks I am over complicating this and it must have been solved before.
Background: I have a Product (eg A book) the product has 20 fields. A Product has a Media Type (PDF, Hardcopy, EPUB) and each Media Type has multiple pricing (price, location ie Europe, Asia, A...
So we have a PHP+Zend Framework+Doctrine 1.2 application that has the following structure:
Controller -> Action -> Service -> Model
Not all models are interacted with through a service. Our current opinion is that a controller could use a model directly and a service could possibly use other services.
My question is: If you have a pi...
I've read about state pattern and now I'm looking to further my knowledge by exploring a Swing application (exple : calculator) that implements it.
where can I find such a tutorial ?
it must showcase a really simple application that uses Swing. I'm confused about how the State Pattern could be used in a Swing project ?
...
Earlier, I asked a question on how to call a static member's member functions so as to initialize it before making actual use of the static object. Then, I realized that I was perhaps making use of the static member in a wrong way, which led to this question:
Given a particular class, MyClass, in how many ways can we design our code so ...
I'm new to design patterns, and thus have a limited knowledge of what all is available. Hopefully I can give some details around the issue I'm trying to solve, and the user community can give some guidance on what design pattern to use and how it should be implemented.
Return object is the same for every type of call
Underlying clas...
I usually try to encapsulate my web service calls in my client side apps.
Rather than doing this:
public Guid FindUserIDSelected(string userName)
{
MyWebServiceReference service = new MyWebServiceReference(GetEndpointBasedOnEnv(Env));
return service.GetUserIDFromName(userName);
}
I have a static class that encapsulates the co...
To avoid NullPointerExceptions I find it useful to provide an immutable dummy implementation of an interface together with the interface. Like this:
public interface Action {
void perform();
public static final Action dummy = new Action() {
public void perform() {
/*nothing*/
}
};
}
Action.dummy can then be us...
I know actionscript does not allowed private contstructor at any time and But if i want to write a sinlgleton class in action script So how to implement it in actionscript.
Can anyone provide an sample example of a singleton pattern in actionscript?
...
Hello,
I have a Request class that can be in one of the following states:
Draft,
Submitted,
Approved,
Rejected,
InMission,
Completed
The state of the Request object can be changed by calling one of the following methods. Each method may include some arguments to further associate some data with a particular state:
void Submit(...
Hello to everyone! I have some problem with organizing classes properly.
Suppose, I have some class ABase. When I want to create some different (more particular) abstraction of this class (denote it AParticular), I can use inheritance or just composition. Then it is easy to treat AParticular as ABase: in case of inheritance it is made a...
Okay this is a design question. I, like many, are still learning Objective-C and Cocoa, and am a little rusty to boot. Anyway, here is the question:
Assume I have a ViewController class 'A'.
Assume I have a "Camera" class 'B', which is a singleton.
Assume I have a UILabel class 'C'.
The ViewController 'A' has knowledge of the "Camera" ...
When designing an XML structure I sometimes find myself wanting to use similar patterns across multiple element types that appear in the same instance document.
For example, the Head-Body pattern can often be useful if you want to keep data and meta data (data about the data) separate, and sometimes it makes sense for multiple types of ...
In OpenGL, one often writes code like this:
glPushMatrix();
// modify the current matrix and use it
glPopMatrix();
Essentially, the state is changed, then some actions are performed that use the new state, and finally the state is restored.
Now there are two problems here:
It's easy to forget to restore the state.
If the code in be...
What's the accepted jargon (if any) for describing methods meant to be invoked only virtually and from other methods in the base? I've occasionally seen this referred to as a callback, but that seems to stray pretty far from the original definition of that term. I'm not even sure that this merits being called a pattern, but I'm trying ...
I am working on a component for merging arbitrary tokens with text in order to generate e-mails. I am going to be using nvelocity for the merging process, so I have defined the following interface:
public interface ITemplateEngine
{
string Merge(string template, IDictionary<string, object> data);
}
Now, in my scenario, the impleme...
In a GUI app using MVP/MVVM, say the Presenter/ViewModel presents a list/collection, and one or more of the items can be selected at a time. Because other parts of the application could conceivably change as the selection changes, does the selection require its own Presenter/ViewModel? If not, how is selection best handled by a given Pre...