Please explain the responsibilities of the presenter and of the business logic, and their interaction in MVP passive view.
Can the business logic(is it the same as model?) modify the view? Or will it pollute the MVP passive view design?
How exactly should presenter use the underlying services?
...
Hi All,
I have a problem at hand and I am not getting which design pattern to use.
The problem goes as such:
I have to build a system which has 'N' states and my system has to do a transition from any state to any other state depending on some conditions.
Ex:
On condition 1, movement from State 1 to 3 and on condition 2 from state 1 ...
Hi,
I have a class that performs database operations and returns results (array, true, false). And I have an another class that creates JSON string by using this class in its constructor.
Can we say this class is an Adapter? Or simply wrapper or ...
Class Db
{
public function getRows($params)
{
//...
}
}
Class DbAd...
What are the design patterns that I should be completely familiar with? And what is one easy example that each can be used for?
I am a web developer (I use Django, and is familiar with separation of logic), but I work at a Desktop-app company. They are always talking about singletons, and I forget...but it leaves me no clue!
...
Hello!
I've read that "Strategy objects often make good flyweights" (from Design Patterns Elements of Reusable Object-Oriented Software), and I'm wondering how can this be implemented. I didn't find any example in the Internet.
Is the code (C#) below right, following this idea?
Thanks!
using System;
using System.Collections.Generic;
...
We have to validate a CSV file containing various configuration parameters. Are there any standard design patterns to do this type of validation.
More details:
There are different types of records - each with their own validation logic
Certain records cross reference other records
There are rules on the order of the records
There are...
I've just started to implement unit tests (using xUnit and Moq) on an already established project of mine. The project extensively uses dependency injection via the unity container.
I have two services A and B. Service A is the one being tested in this case. Service A calls B and gives it a delegate to an internal function. This 'callb...
This is in my opinion an abstract problem and I hope I can explain it well. I happened to find the same kind of problem in a completely different project and now I have it again and I would like to avoid it if possible.
I'm creating some classes to simplify some tasks for some specific requirements we have in some projects at work.
I ...
Is there any other documentation/discussion about the following design pattern (I'm not sure what it is called) from a well-known source? I'm almost 100% sure that the following will manage data safely between two (not more than two) processes, but would feel much better if I could find some more detailed information on why it works from...
Let's say that I have a bunch of objects (thumbnails in a matrix for example) and I need to load some data files for all of those over the network (HTTP). So each thumbnail has the thumbnail image itself and an xml file for instance.
There's a number of things that can go wrong from IO errors to bad URLs to badly formatted XML and so on...
We've got a set of classes which derive from a common set of interfaces such that
IFoo-> BasicFoo, ReverseFoo, ForwardFoo
IBar -> UpBar, DownBar, SidewaysBar
IYelp -> Yip, Yap, Yup
wherein the constructor for the Foo's looks like Foo(IBar, IYelp) These items are used throughout the project.
There exists another class which has a met...
Hi Guys,
I have a fully implemented DAO and all my beans inherit an Entity object.
Now, I want to create a client notification system whereby, when a user creates/updates/delete an entity to/from a persistence storage, a notification is automatically sent to the client via email.
I have a DAO manager that uses a Factory Pattern to ret...
Hi Guys,
I need to implement a Query Object Pattern in Java for my customizable search interface (of a webapp I'm writing).
Does anybody know where I can get an example/tutorial of Query Object Pattern (Martin Fowler's QoP)?
Thanks in Advance
ADDITION How to add a Query Pattern to an existing DAO pattern?
...
I love the elegance of Zend_Controller_Router_Rewrite and the various route classes it uses.
I'd like to write a very similar routing system as a standalone component so I can translate URLs into a set of parameters and assemble them back again. The idea is to use them to select, say, an URL normalization handler on a per-path basis.
...
I know SQL but wanted to master it for use in complex SQL and try to create complex SQL statement in one query. Any book to recommend. I found this book: SQL Design Patterns by Vadim Tropashko. What do you folks suggest?
...
Here is what what I understand so far:
Java beans are just to help other things (visual things?) interact with your code. I think that this is mostly for UI stuff because it is easier to design this visually. Is it bad practice to use Java beans for non-UI things?
Java beans have getter and setter methods (bad OOP practice) and are...
I have a repository pattern setup using NHibernate. The base class looks like this:
public interface IUnitOfWork : IDisposable
{
void Commit();
void Rollback();
}
// generic NHibernate implementation of IUnitOfWork here
public class NHibernateRepositoryBase<T> : IRepository<T>
{
private NHibernateUnitOfWork _unitOfWork;
...
I have a function with logic that looks like this:
doStuff1()
try:
doStuff2()
except type1:
error1()
return endstuff()
except type2:
error2()
return endstuff()
except:
error3()
return endstuff()
if doStuff3():
error4()
return endstuff()
doStuff4()
return endstuff()
As you can see, endstuff() is do...
I'm writing a small data structures library in C#, and I'm running into an architectural problem. Essentially I have a class which implements the visitor pattern, and there are many possible implementations of visitors:
public interface ITreeVisitor<T, U>
{
U Visit(Nil<T> s);
U Visit(Node<T> s);
}
public abstract class Tree<T> ...
Hi,
I'm having trouble applying the visitor pattern for an interpreter in C++. The following code produces (+) rather than ((1+2)+3) as desired:
class ExpVisitor{
public:
virtual void visit(class Add*)=0;
virtual void visit(class Int*)=0;
};
class Exp{
public:
virtual void accept(ExpVisitor *v){};
};
class Add : publ...