design-patterns

Are there any patterns used for communicating between browser windows in an ASP.Net web app?

First, some background... I have a mapping application in which a child window can open where there are links. When a link is clicked the child window needs to say "Hey map! such-and-such link was clicked now zoom to this location and mark it." I'm trying to think of a good clean way to accomplish this. Are there any patterns out ther...

Is there a normalized form for representing several objects from different tables?

For a system I am currently building, the following two scenarios occur: My permissions system is the perennial favorite of attaching permissions to roles, and roles to users, but with a twist: permissions may be applied to any asset at any tier, and there are 4 "Tiers", numbered 0 through 3. As such, the role assignment table is 5 fi...

Django: Chicken or Egg question.

I am building an application that will send an API call and save the resulting information after processing the information in a APIRecord(models.Model) class. 1) Should I build a separate class in such a way that the class does the API call, processes the information (including checking against business rules) and then creates an insta...

MVP (Model View Presenter) or MVC (Model View Controller)

I already know the difference between MVP and MVC. Then also after going through the SRS of an application i get in a Fix which one need to be picked, applied and followed as Applcation Architecture. As per my understanding I would pick MVP where there is the chances of using the Same Business Logic, from more than 2 GUIs. Like for a app...

What funtionalities can be put in the presenter for the MVP Design pattern

I have been using MVP for a while .Sometimes I get confused what actions can be performed inside the presenter. For me ,I have a presenter only serves as layer to talk to the service layer(data access and other utility class) and update the view. Can anyone share some thought on what actions can be performed in the presenter and what can...

When should I create new Controller class in Asp.net MVC (Design Question)?

Hi all, Before I ask the question, here is my understanding about Controller in MVC pattern. Controller is Application Layer (in DDD) It controls Application flow. It is kept thin It controls unit of work (a.k.a Transaction) My question is "when should I create new Controller class?". I'll take an example as DinnerController in Nerd...

What are some specific legitimate uses for singletons?

Possible Duplicate: On Design Patterns: When to use the Singleton? This question is not about whether or not singletons are "considered harmful" in general. I just want to know, from your experience, what are some SPECIFIC SITUATIONS in which singletons seem to work well. EDIT: Please, if you want to discuss the appropriateness...

Design question

Hi everbody, We are building software in java, and are new to it. I confused about JPA. Normally in MVC pattern, SQL queries are hidden in model. And controller can't access the db directly. When I use JPA, should model retrieve JPA object to controller? If yes, then controller has access to db, and this is against to pattern? ...

Encapsulate Use Cases in a software

I usually write use cases for all the software that I develop. For each use case I generally write a controller which directs the flow (implements a use case). I have recently started developing web apps using Asp.net MVC. One of the best practices of Asp.net MVC is to keep very less logic in the controllers. I am not able to figure ou...

Creating a Publish-Subscribe Pattern to integrate to the DAO pattern.

Hi everyone, Based on the question (http://stackoverflow.com/questions/2068425/how-to-create-a-client-notification-service-for-a-webapp-or-should-i-use-an-obser) I will like to know. I have a fully implemented DAO with Entity beans containing only getters and setters method. Each entity is mapped to an EntityManager. Currently there ...

MVVM Madness: Commands

I like MVVM. I don't love it, but like it. Most of it makes sense. But, I keep reading articles that encourage you to write a lot of code so that you can write XAML and don't have to write any code in the code-behind. Let me give you an example. Recently I wanted to hookup a command in my ViewModel to a ListView MouseDoubleClickEvent. ...

Fine-grained decorator pattern

I understand the Decorator pattern, in it's simplest terms. The idea being that one class wraps another, where a decorator method wishes to run some other code before and/or after calling the same method on the decorated object. However, I have run into the situation where I cannot simply call the decorated method, as it has some undes...

Why does the client have no reference to the invoker in the Command pattern?

Link to command pattern Why does the client have no reference to the invoker when it has references to receivers and concretecommands? public static void main(String[] args) { StockTrade stock = new StockTrade(); BuyStockOrder bsc = new BuyStockOrder (stock); SellStockOrder ssc = new SellStockOrder (stock); Agent agent...

Memento Implementation in VBA

Hi, I'm looking for a VBA implementation of the Memento pattern (GoF). I'm looking at converting the Java version from Wikipedia. It will be used for Undo/Redo functionality for an Excel add-in. Specifically, I am having difficulty with the line: return new Memento(state); Or, to make it more specific, can someone rewrite this in VB...

Domain driven design and transactions in Spring environment

I used to design my application around anemic domain model, so I had many repository object, which were injected to the big, fat, transaction-aware service layer. This pattern is called Transaction script. It's not considered a good practice since it leads to the procedural code, so I wanted to move forward to the domain driven design. ...

The Model-Repository-Service-Validator-View-ViewModel-Controller design pattern (?)

When I first heard about ASP.NET MVC, I was thinking that would mean applications with three parts: model, view, and controller. Then I read NerdDinner and learned the ways of repositories and view-models. Next, I read this tutorial and soon became sold on the virtues of a service layer. Finally, I read the Fluent Validation documentati...

Difference between singleton and factory pattern

Hi, I'm new to design patterns and I cant really see a difference between this two patterns, both are creational patterns arent they? and what is the purpose of each pattern? thanks. ...

How can the proxy pattern be used to replace a singleton?

Hi all, This is in response to some comments in what is so bad about singletons There it was suggested that the proxy pattern can be used instead of a singleton to cache DB data. But I cannot see the advantage, and in fact the singleton seems more "controllable". Let me elaborate on the problem. Assume you have a database, with a la...

Are there patterns for model / entity classes

What is the best approach to take when you are pulling model objects from multiple datasources? For example I have an application has has some data stored in a mySQL database using hibernate. What If I wanted to store some other objects in EC2 or Google App Engine? I understand that DAO's abstract the implementation of working with ...

Can Model Observe View ?

I am developing an application in Java, in my GUI I have several JPanels with a lot of settings on them, this would be the View. There is only one Model in the background of these several JPanels. Normally, I would Observe the Model from the JPanels. I was just wondering, is it good practice to Observe View from the Model? Because, the...