design-patterns

Is there a Django apps pattern equivalent in Google App Engine?

Django has a very handy pattern known as "apps". Essentially, a self-contained plug-in that requires a minimal amount of wiring, configuring, and glue code to integrate into an existing project. Examples are tagging, comments, contact-form, etc. They let you build up large projects by gathering together a collection of useful apps, ra...

Provider Pattern & DefaultProvider

Hi, I am trying to implement the provider pattern in a custom web control. I am still trying to understand the pattern and I have the following questions. Is the default provider the provider that is always going to be used when my control loads? From what I can tell the provider used will always be the default but I am not sure becaus...

What are your tips for best practice for web application structure?

I do a lot of custom applications at work. I'm trying to define some standards for new applications. Something a little like Elements. CSS: How do you organize the style sheets? Should I have one base style sheet for the whole site and one for each individual page for customizations? Should I have another for print styles? I've hea...

Design considerations for a class full of static methods

As a Swing developer for as many years as one can possibly be a Swing developer, I've identified a lot of patterns that I use in laying out components. For example, I often create components that are associated with a JLabel. I usually write: JPanel panel = new JPanel(new BorderLayout()); panel.add(label, BorderLayout.NORTH); panel.ad...

How to go beyond callback programming?

I've noticed that a big part of my code is built around callbacks. Is this considered a "design flaw"? Are there better design patterns that I should follow? ...

Is a "master preferences" class a good idea?

I have a class that manages user preferences for a large software project. Any class in the project that may need to set or retrieve a user preference from a persistent store is to call the static methods on this class. This centralized management allows the preferences to be completely wiped programmatically - which would be impossibl...

Does n tier architecture break OO concept of encapsulation

I have an n tier application with presentation layer, business layer, DAL and business objects layer. Separating the objects and the operation written on the objects break the object oriented concept of encapsulation. ...

oo-spaghettio web architecture

I've noticed that the majority of enterprise web apps I've worked on over the past few years have seemingly mis-used the powers of oo. That is, what once would have been perhaps 1000 lines of HTML and script, has often now morphed into 10,000 lines of code, 50 classes, and 2000 method calls to do basically the same thing. I.e. oo and l...

Which C# design pattern would suit writing custom workflow in asp.net

Trying to find some examples on the intertubes. I am thinking of state or strategy pattern but if anyone has any war stories, examples or resources that they could point me to it would be appreciated. I don't/can't use windows workflow. My example is that i have a complex wizard that changes the state of the process based on what user ...

Pattern for Plugins - IoC/DI or not?

Just a very general question, that not only applies to this example. Let's say you have an Online Shop and you want to implement Vouchers/Gift Certificates, but with Constraints. Let's say you have a voucher for 20% off, but that applies only to products added within the last 3 weeks, but not to ones in a special promotion. I see two w...

UI Design Pattern for Windows Forms (like MVVM for WPF)

MVVM is most commonly used with WPF because it is perfectly suited for it. But what about Windows Forms? Is there an established and commonly used approach / design pattern like this for Windows Forms too? One that works explicitly well with Windows Forms? Is there a book or an article that describes this well? Maybe MVP or MVC based? ...

Save as you go web forms --- pattern request

Rather than using a "save" button on a web form, many web designers like a "save as you go" approach. Where as the user's changes to the data are saved immediately once the user changes focus out of say a text box. Has anyone identified a formal pattern for this technique? I especially need to tie it all back to chunky service call. ...

Which layers should speak Domain Models?

Let's say I have a method like this in my business layer: // This is in the business layer public Result DeleteSomeDomainObject( ???? ) { //Enforce business logic here. //Delete records in the database DAL. DeleteSomeDomainObject( ??? ) } // This is in the data access layer public Result DeleteSomeDomainObject( ???? ) { /...

In domain-driven design, would it be a violation of DDD to put calls to other objects' repostiories in a domain object?

I'm currently refactoring some code on a project that is wrapping up, and I ended up putting a lot of business logic into service classes rather than in the domain objects. At this point most of the domain objects are data containers only. I had decided to write most of the business logic in service objects, and refactor everything aft...

C# Multi Thread Design Example

I am relatively new to C#/.Net. I'm developing a desktop application that requires multi threading. I came up with the following pattern below as a base. I was wondering if anyone could point out how to make it better in terms of coding, being thread safe, and being efficient. Hopefully this makes some sense. public abstract class Th...

What is the best way to encapsulate Linq to SQL data access?

I've been trying to encapsulate the object mapping in a projects data repository. Perhaps EF will provide the level of abstraction required but for a range of reasons I am using Linq to SQL at the moment. The following code aims to return the users in the database as a list of ModUser objects, where ModUser is POCO that the repository ex...

Example(s) for State Pattern in open source software?

The question says all. Preferably in c# or java. ...

Do roles/views belong inside or outside of the Repository Pattern?

Does role / view logic belong inside or outside of the Repository Pattern? For example, I have a table of products, and each product has 5 price fields - one for each type of customer (wholesale, retail etc). I only want to show the appropriate price to the appropriate user. If I have a repository of these products, should the Product...

Handling of UI state

I have application running on Windows written using MFC. The enable/disable state of the menu items depends upon a lot of conditions. For example, I have to enable the menu item if condition A is satisfied OR if condition B is satisfied, but should be disabled if both A AND B are TRUE at the same time. How do we model this in code ? I t...

Long-running callback contract via WCF duplex channel - alternative design patterns?

I have a Windows service that logs speed readings from a radar gun to a database. In addition, I made the service a WCF server. I have a Forms and a CF client that subscribe to the service and get called back whenever there is a reading that satisfies certain criteria. This works in principle, but after some time the channel times out. ...