design-patterns

Domain Maintenance Controls/Forms, is there a Pattern?

Hi, I'm working on an application that has a large domain - i.e. Customers, SalesOrder, Suppliers, Products, Stocks etc. - and have discovered that the WinForms data binding is a little too restrictive for what I need. Is there a useful design pattern for setting up the populating of forms and updating of the underlying data? Thanks ...

connector acceptor pattern

Hi From where I can get link to connector acceptor pattern explained simple ,and also a sample code . The one I get http://www.cs.wustl.edu/~schmidt/PDF/Acc-Con.pdf , I find difficult to understand. ...

Is this really an example of the adapter pattern?

I have an interface -- "EventHandler" -- that declares several methods. public interface EventHandler { void handleEvent1(); void handleEvent2(); void handleEvent3(); void handleEvent4(); } I also have a class -- "EventHandlerAdapter" -- that implements EventHandler. However, it doesn't actually "implement" anything...

Tips for Manually Managing Persistence Context

I am investigating using JPA for my Data Access code. I am trying to write the business layer and data access layer so it will work in a web application and a Java SE application. Therefore I cannot use container managed persistence context. Most of my seraches on using JPA show examples in a container managed enviroment. At the mome...

design pattern problem

Hello I have a application design problem and I home you can help me solve it.... This is my first application in silverlight and the first application using mvvm design pattern and I am not sure I am applying mvvm how I am supposed to.. The application is a dynamic application and at runtime I can add/remove usercontrols... So I have ...

Can we inherit singleton class?

Hi, Can we inherit singleton class? ...

Is it wrong to call a class a FooFactory if it doesn't *always* create Foo objects?

Is it wrong to call a class a FooFactory if it doesn't always create Foo objects? For example if I have the following interface: public interface IFooFactory { Foo Create(); } and implement it as follows: public class FooFactory : IFooFactory { public IFoo Create() { return ServiceLocator.Current.GetInstance<IFoo>...

Cheat sheet for all design patterns implemented in Ruby?

I wonder if there are cheat cheets for all design patterns implemented in Ruby so that you don't have to reinvent the wheel. ...

Alternatives to this development pattern

Usually I start with pure model objects, usually in a tree structure. Depending upon the application, I will end up adding functionality to the model heirarchy, such as attaching UI controls and other data depending upon the application. Usually I'll do this by walking through the heirarchy and placing additional functionality on the ...

php Singleton pattern with Abstract class and Interface

I am developing a framework. And I have confronted with some difficulties. For Database I have created Abstract class, Interface and some Adapters for different SCDB. For example, Mysqli adapter has the constructor, which call the constructor of parent with settings array as parameter. Mysqli class uses the next scheme: class Hybrid_Db_...

Comparison of Specification Pattern, Func<T,bool> Predicates and Pipes & Filters

Hi Guys, I'm doing some R&D work, and as such am exploring design patterns. I have recently been reading up on the Specification pattern and was referred to this great article. I was intrigued by the simplicity and cleanliness of the code, but i started to draw some comparisons to implementing the same cleanliness using other techniq...

Asynchronously Processing a Batch Request in Serialized Order

I have a request that contains a batch of "tasks" that need to be completed. An "asyncstate" object that gets passed around via both the request/response contains a collection of "PendingTasks" and "CompletedTasks". Once a task has been complete by a request handler, it gets moved into a "CompletedTasks" collection. If the original re...

Snippets/examples for practical rubyish design patterns?

I wonder if there are Ruby snippets for various design patterns you can use in Ruby. Examples: Builder method Declare ghost methods Using blocks for DSLs (like Rails) So that one doesn't have to reinvent the wheel. Im not talking about books, but a collection of ruby snippets for various practical things, nothing abstract and gener...

Clarification in dealing with collections with the repository pattern

If you have two repositories dealing with persistance to a relational DB, a personrepository that deals with "Person" objects, and an addressrepository which deals with "Address" objects, and a person object has a collection of addresses (probably lazy loaded). Obviously the personrepository would be used to persist changes to the person...

Is dofactory.com's Design Pattern Kit for C# worth the money?

It's not too pricey and I want to learn more about design patterns. Is this a decent product or is my money better spent somewhere else? One advantage, potentially anyway, is it appears to be a good-sized chunk of content and usable offline, unlike Google or Wikipedia. ...

How to dependency inject a class / type?

I'm struggling with a design problem and I don't want my code to become a mess because of a bad solution. Rather than give a poor analogy I'll just explain my exact case. I'm trying to write a clone of Wii Play Tanks, and I'm having trouble designing the Tank classes. Tank itself is the only such class, it uses dependency injection for ...

C++ pattern to prohibit instantiation of a class outside a certain scope?

I have a System class that can return a pointer to an Editor class. The Editor class is instantiated within the System class and passed pointers to System's private variables. The Editor class essentially acts as an alternative interface to System's internal data structures. My question: Does a design pattern exist that allows me to pr...

Design Pattern/methodology for a Time Based functionality

A car entertainment system can only be controlled by a remote controller. The remote controller has up/down buttons for scrolling media files. The functionalities of these buttons are given below a. If the user releases the up or down button 1500 ms after (before 2000 ms) pressing it, the selection goes up or down respectively. b. if th...

Is the Visitor pattern the best way to refactor domain enums to classes?

If we want to refactor an enum (contained in the domain layer) to a polymorphic class, using "simple" abstract methods could be a bad idea, if all the switch and if statements we want to refactor are inside the other layers (like the business or the presentation layer), because we could end up to reference these layers inside the domain ...

Design Problem : Single Record Might Change - Don't want to waste a table

I have a situation where I need to create a 'master object' instance by which all others will inherit from, in a project that uses the Entity Framework (4.0). I could just set up this object, and add a record to the database for it, and everything pull from that. But that seems ...like a real waste. An entire table, for one record? Th...