design-patterns

All my tests are ignored in Nunit

I have written a HomePageClass Imports System Imports System.Collections.Generic Imports System.Text.RegularExpressions Imports System.Text Imports WatiN.Core Namespace TestDesign Public Class HomePage Inherits IE Public Const HomePageURL As String = "test" Public Sub New() MyBase.New(HomePageU...

assigning a serial number to a client from a pool of serial numbers

Hello, I have a sql server table of licence keys/serial numbers. Table structure is something like; [ RecordId int, LicenceKey string, Status int (available, locked, used, expired etc.) AssignedTo int (customerId) .... ] Through my ASP.NET application, when the user decides to buy a licence clicking the accept button, i need to reserv...

How Can I Keep The 'GUI' Layer Out Of The 'Business Logic' Layer?

I currently have a project that is a 'Business Object' project, and our goal is to have a clear separation between the GUI and the Business Objects. However, my project has a reference to System.Windows.Forms and that's a big red flag to everyone that my project is poorly designed. My problem is that I'm using a 3rd party control calle...

Business/Domain Object in ASP.NET

Just trying to gather thoughts on what works/doesn't work for manipulating Business/Domain objects through an ASP.NET (2.0+) UI/Presentation layer. Specifically in classic ASP.NET LOB application situations where the ASP.NET code talks directly to the business layer. I come across this type of design quite often and wondering what is t...

Two tier application later modifiable to three tier application

We are considering a two tier application. However later we may want to convert that to three tier application. Is there any design pattern/framework/technology helpful in that? The main reasons for considering two tier are: 1) Single low end desktop machine is available for running the application. 2) Only single user currently. 3) A...

What practical experiences you have from using Software Design Patterns ?

Wikipedia has a good summary about the various design patterns. Which ones have you used at most in practice and what are your experiences? When should one go for a pattern and when not ? Edit: A cool C# based link with practical DP examples ( tnx to Mladen Mihajlovic) ...

MVVM Dependencies between View and ViewModel

Currently there are a lot of variations on the MVVM design pattern but as I understand it the view is allowed to have dependencies on the viewmodel. A colleague of mine disagrees but he couldn't provide a satisfactory explanation. E.g. my views contain a reference to their viewmodel. This is not needed for all views but it helps when co...

ASP.NET C#: Which Design Pattern should I use and why?

I am developing an app in ASP.NET C# and came across the following scenario: I will have to create some maintenance screens for different entities (tables) Those entities will basically have the same behaviour within the UI: Search, GetById, Save, Create and GetAll The entities may have different structure i.e. different properties (fi...

Need a pattern to call Verify method for every instance method pattern

I have the following code: class Foo { public Foo() { Size = true; } private bool _size; protected bool Size { get { _size; } set { _size = value; } } } class CrazyFoo : Foo { public void First() { if (!Size) return; } public void Second() { if (!Size) ...

bad design? a class that can cause an error in a package

Suppose I create a some client code consisting of a couple of classes. A user is able to create a class/object that causes an exception to be thrown. Is this bad design? Should your ideal code be such that it is impossible for someone to cause an exception? ...

How to implement SOLID principals into an existing project

I apologize for the subjectiveness of this question, but I am a little stuck and I would appreciate some guidance and advice from anyone who's had to deal with this issue before: I have (what's become) a very large RESTful API project written in C# 2.0 and some of my classes have become monstrous. My main API class is an example of thi...

Using Model-View-Presenter pattern in a MFC application

I work in the ui of a "quite" big MFC application. We tried to split the application in modules to isolate the business logic but anyway there are still many places where the ui has some business logic that shouldn't be there. This business logic is difficult to test and changing a control is sometimes a real pain. But...you all know wh...

MVP and multiple User Controls

I’m trying to use the MVP pattern and I’m running into a design problem. I’m developing an application that will have several UserControls. The UserControls themselves have nothing to do with one another and only represent a subset of the actual model. From what I’ve read, people tend to say you should use one Presenter per View. Thi...

MVC - How does it work in the real world?

I've read a lot of trivial MVC examples of calculators and thermometers but I can't seem to map the pattern to real world applications. Suppose you have a more complicated scenario. Say you have a website shopping cart which requires users to login before adding to the cart. First, the user sees the product page (/product/detail) and cl...

Handling client-side domain object state in a presentation model.

I'm currently building the client side of a Flex/PHP project using the Presentation Model pattern. What I'm trying to achieve: I currently have a view displaying non-editable information about a domain object called Node. Depending on if the Node is editable and the user has the right privileges, an additional view becomes available whe...

DDD - Factory Method and Dependency Injection

Hello, I' am a bit stuck on a peice of design which i hope this group can help. I am new to DDD and would like an opinion on how to solve this problem. I have a Currency Value Object that needs to access a repository to get addditional data to make the class complete. The problem (or design issue) is that new instances of Currency can ...

C++ Design Pattern for a Messaging System?

I'm tasked with implementing a messaging system for a real-time simulation. There are several different kinds of messaging objects that need to exist in this system, and more might be added in the future. These objects represent the primary means of communication between the players in the sim. Assuming I fully understand my requireme...

How to properly implement the Strategy pattern in a web MVC framework?

In my Django app, I have a model (lets call it Foo) with a field called "type". I'd like to use Foo.type to indicate what type the specific instance of Foo is (possible choices are "Number", "Date", "Single Line of Text", "Multiple Lines of Text", and a few others). There are two things I'd like the "type" field to end up affecting; the...

Is this a good use of the Singleton pattern?

I make a lot of "design your own ____" applications. What I do is I make a singleton class to hold all the customizations the user has chosen. For example: When you select you want something green, it updates a getter/setter in the singleton to be green. Then when the application needs to know what color was selected it gets the info fro...

Company & Contacts Object Design Help

I am hoping that someone (or some people) could help us with a problem that we have wrangled with for a few days. How to organize our business objects given the attached diagram? We are looking for any assistance (ideas about where to or how to search for the design pattern(s)/object model(s) we could use in order to solve this probl...