design-patterns

Should I be trying to create a reversible enum in Java or is there a better way?

I seem to have faced this problem many times and I wanted to ask the community whether I am just barking up the wrong tree. Basically my question can be distilled down to this: if I have an enum (in Java) for which the values are important, should I be using an enum at all or is there a better way, and if I do use an enum then what is th...

Proper design a Model-Controller in Cocoa?

Hi, I'm trying to design a simple Cocoa application and I would like to have a clear and easy to understand software architecture. Of course, I'm using a basic MVC design and my question concerns the Model layer. For my application, the Model represents data fetched on the Internet with a XML-RPC API. I'm planning to use Core Data to re...

What Design Patterns do you implement in common Delphi programming?

Hello fellow programmers, As I'm a learner and user of design patterns and Delphi I would like you to ask a question which you may find subjective (Ooo just another "what's the best?"). What Design Patterns do you implement in common Delphi programming? What patterns are easier to adapt in Delphi programming? (Every language is excelle...

Coding approach/pattern to use DataSet as domain objects for a small application?

Hi, Assumption - For a simple app I have with only a few tables & I plan to stay simple and use DataSet for my data access as well as domain layer. In other way, in this small application, I won't create separate classes but rather just use the DataSet directly. Question - Does anyone have any code/patterns/suggestions re how best to...

How to refactor this?

Hi, I'm struggling with a small issue with regard to how I go about refactoring this to a decent pattern. public class DocumentLibrary { private IFileSystem fileSystem; private IDocumentLibraryUser user; public DocumentLibrary(IDocumentLibraryUser user) : this(user, FileSystemFrom(user)) { } public DocumentLibrary(IDo...

Java Design Pattern

I am trying to design an application where I will have a Map of IAction objects. Each IAction object has a method IAction IAction.processAction() where it is executing the knowledge contained within it. This could querying the database calling a web service, etc. After the execution of each IAction control is then sent to the next IA...

Design pattern for taking user input and invoking method

I need implement a control solution for a computer game I am writing to take user input . I am looking at the Command pattern, but not sure if its a good fit for this. ...

Resources for What and how NOT to use ASP.NET AJAX?

It's very easy to put an UpdatePanel and have AJAX working. I am looking for resources on how to best use ASP.NET AJAX for maximum performance and security. Resources for best practices, guidance, design patterns, gotachas, pitfalls when using ASP.NET AJAX. I am not looking for books on ASP.NET AJAX. Amazon lists those. ...

What are the Gang-of-Four(GoF) Design Patterns used in the Spring Framework?

Spring Framework is a lightweight dependency injection and aspect-oriented container and framework. AspectJ is a seamless aspect-oriented extension to Java, which means that programming in AspectJ is effectively programming in Java plus aspects. As AOP introduces its own terminology, Spring has adopted it for the sake of consistency wit...

Make my C++ Class iterable via BOOST_FOREACH

I have a class which I want to expose a list of structs (which just contain some integers). I don't want the outside to modify these data, just iterate over it and read them Example: struct TestData { int x; int y; // other data as well } class IterableTest { public: // expose TestData here }; now in my code I want to use...

Use of helper/utility methods in a Factory class

I have a question about the usage of "utility/helper" methods in a factory class. Consider an example of an XML string that reprents a document. I have a class that transforms it to an "object" (say PDF, Word, CSV, etc.). I have a factory class (lets call it DocumentFactory) that accepts this XML string and based on certain rules gives b...

How is this design pattern called?

Hi. How do you call this design pattern? class Foo { protected $delegates = array(); //... public function __call($method,$argv) { //call $this->$something->$method($argv), where $something is a mapping from $this->delegates } } I can speculate, but I'm not sure, so I wanted to ask you. ...

How to implement the Strategy Pattern in AOP

Can anyone tell me how to implement the Strategy Pattern in AOP? An example using Spring-AOP or AspectJ would be very helpful. ...

If it is technology specific, is it still a design pattern?

I went to a .NET user group meeting tonight, and part of it revolved around the model-view-view model pattern, and it got me wondering if this qualified as a pattern. The issue I have is that M-V-VM is extremely technology specific. If you do not use WPF and its binding mechanism, I don't see how you could use that pattern. By contrast, ...

Design Problem - Common base class and different return types

What I have? I have an abstract class QueryExecutor and many classes inheriting from it, I have just given two of them. The logic of constructing the result object is same but, each inherited class returns a different collection - some of them are in System.Web.UI.WebControls namespace and some are custom collection classes. abstract c...

MVC: does anyone know a multi view design for MVC?

I have a system that need two representations of the same model, and for simplicity i want to use one model, and not keep multiple models - because than my system will suffer from translation errors (the models will not be compatible) that might cause the system to be faulty. Does anyone know a good design practice for that problem? ...

Spring AOP vs AspectJ

I am under the impression that Spring-AOP is best used for application specific tasks such as security, logging, transactions, etc. as it uses custom Java5 annotations as a framework. However, AspectJ seems to be more friendly design-patterns wise. Can anyone highlight the various pros and cons of using Spring-AOP vs AspectJ in a sprin...

Recommendations for handling list selection of data in a web application?

I am struggling with what the better practices or recommended ui design patterns are for making selections from a list of data, more specifically, key/value data. My questions are: When should I use a drop down? When should you employ a list of radio buttons verses a drop down? When should I use a list box? If you do allow for m...

What would be the appropriate patterns ?

Recently i faced an interview.I answered some questions well.For some questions,without knowing answer also,i answered as if i were aware of the answer.one of such question is to find out the matching pattern of the following. Don't laugh at my answers.Just i tried my level best at interview. Item Pattern ...

Is it bad practice for a delegate to have a reference to the object for which it is the delegate?

I'm using the delegate pattern for one of my objects. My idea is that I will be able to swap the delegate out later for a different delegate implementing a different strategy. I suppose this is just as much the strategy pattern as the delegate pattern. My question is, is it bad practice for my delegate to have a reference back to the ...