9
votes
2answers
205 views

I should have used a factory method instead of a constructor. Can I change that and still be backwards-compatible?

The problem Let's say I have a class called DataSource which provides a ReadData method (and maybe others, but let's keep things simple) to read data from an .mdb file: var source = new ...
0
votes
0answers
53 views

Extension objects pattern

In this MSDN Magazine article Peter Vogel describes Extension objects partten. What is not clear is whether extensions can be later implemented by client code residing in a separate assembly. And if ...
1
vote
1answer
108 views

Multi-user Configuration Settings design

I am designing a flexible and extensible way to store configuration settings for users. Database Table Design: ╔═════════════════════════════╗ ║ ConfigurationItemDefinition ║ ...
0
votes
0answers
68 views

Patterns for refactoring

I have a existing legacy library which has multiple helper classes. For example Helper1, Helper2. They are not well organized. I want provide an easy to use interface like this: ...
0
votes
2answers
124 views

Implementing Context-based Undo/Redo Functionality

I'm currently implementing an undo/redo mechanism using the Command Pattern. Everything works so far. My problem now is to implement the undo/redo functionality in a way that it is bound to a given ...
5
votes
2answers
244 views

Which design pattern is illustrated by inheriting IStructuralComparable interface?

We know that some design patterns are found so useful that they become features of the language itself. For instance, the interface IEnumerator which is implemented by Array object. This helps in ...
3
votes
1answer
118 views

Are Request/Response Parameter Wrappers Good Practice?

I've seen several different ways to design WCF services, and it seems some developers prefer parameter wrappers while others favor 'naked' parameters. To explain what I mean, consider the following ...
2
votes
1answer
224 views

What kind of abstraction/SoC should I use here?

I am starting a new project, and I want to follow the separation of concerns pattern, and I have been reading on the topic, and now I am in doubt of how I should go about this. Here is how I ...
3
votes
4answers
181 views

Should we validate a state transition before attempting it in the State Pattern?

When applying the State Pattern illegal transitions should result in an exception being thrown (or at least that's what I understood from the pattern) I know exceptions are for "unexpected behavior" ...
4
votes
4answers
355 views

What the right pattern to Use here

scenario: I have an entity called Member. Members fall into multiple types. Some types are below. Supporter Volunteer Sponsor Player I can create class for each type and inherit from the base ...
1
vote
1answer
145 views

Class structure/pattern for validating several different Excel templates?

I'm trying to validate the contents of Excel sheets that follow several different templates. For each one, there are three possible validation actions for various cells: Regex (e.g. "XYZ-123" fails ...
5
votes
1answer
485 views

Are we using the repository pattern right?

We are using a bunch of separate classes suffixed with -repository to retrieve the data from the database; for each table its own repository. We have for instance a customerrepository class which has ...
4
votes
3answers
456 views

Is there a design pattern to solve this problem?

I've been struggling with a design so I figured I'd ask here and see if anyone's able to help :) High level overview I'm designing an app to gamify exercise by creating mini competitions (ex. Who ...
13
votes
3answers
487 views

Does the state Pattern violate Liskov Substitution Principle?

This image is taken from Applying Domain-Driven Design and Patterns: With Examples in C# and .NET This is the class diagram for the State Pattern where a SalesOrder can have different states during ...
2
votes
2answers
138 views

Designing entities to be self-manageable

Although this is a gamedev project, the question is about general OOP practices, so I believe it goes here. Here's the problem: (note: I will call any equivalent of real-world physical objects ...
1
vote
1answer
220 views

What is the best way to compose an object with components across two assemblies?

In my project, I have a collection of classes. These classes for the most part contain data which is updated infrequently or not at all - that is they don't really do much - their purpose is to be ...
6
votes
2answers
817 views

Creating a Predicate Builder extension method

I have a Kendo UI Grid that I am currently allowing filtering on multiple columns. I am wondering if there is a an alternative approach removing the outer switch statement? Basically I want to able ...
5
votes
3answers
436 views

Manager/Container class vs static class methods

Suppose I have a Widget class that is part of a framework used independently by many applications. I create Widget instances in many situations and their lifetimes vary. In addition to Widget's ...
3
votes
6answers
931 views

Designing a Business Rule Engine

I have a requirement where there are 10 Rules to be applied on data in excel. If Rule 1 and Rule 2 fails rest of the rules are not checked. But if Rule 1 and Rule 2 passes the rest of all the Rules ...
5
votes
1answer
151 views

Object oriented wrapper around a dll

So, I'm writing a C# managed wrapper around a native dll. The dll contains several hundred functions. In most cases, the first argument to each function is an opaque handle to a type internal to the ...
3
votes
1answer
434 views

How to manage long running background threads and report progress with DDD

Title says most of it. I have found surprising little information about this. I have a long running operation of which the user wants to see the progress (as in, item x of y processed). I also need to ...
1
vote
3answers
130 views

Figuring out the Call chain [closed]

Let's say I have an assemblyA that has a method which creates an instance of assemblyB and calls its MethodFoo(). Now assemblyB also creates an instance of assemblyC and calls MethodFoo(). So no ...
3
votes
4answers
1k views

C# Open Source software that is useful for learning Design Patterns

In college I took a class in Expert Systems. The language the book taught (CLIPS) was esoteric - Expert Systems: Principles and Programming, Fourth Edition. I remember having a tough time with it. ...
4
votes
2answers
217 views

What is the right way to group this project into classes?

I originally asked this on SO, where it was closed and recommended that I ask it here instead. I'm trying to figure out how to group all the functions necessary for my project into classes. The goal ...
0
votes
1answer
432 views

A sample Memento pattern: Is it correct?

Following this query on memento pattern, I have tried to put my understanding to test. Memento pattern stands for three things: Saving state of the "memento" object for its successful ...
4
votes
5answers
2k views

Best way to load application settings

A simple way to keep the settings of a Java application is represented by a text file with ".properties" extension containing the identifier of each setting associated with a specific value (this ...
12
votes
3answers
527 views

How can you tell whether to use Composite Pattern or a Tree Structure, or a third implementation?

I have two client types, an "Observer"-type and a "Subject"-type. They're both associated with a hierarchy of groups. The Observer will receive (calendar) data from the groups it is associated with ...
11
votes
0answers
220 views

Return magic value, throw exception or return false on failure? [duplicate]

Possible Duplicate: Return magic value, throw exception or return false on failure? We've all seen these: a string format error, end of stream, item not found. While coding a class library ...
21
votes
7answers
2k views

Return magic value, throw exception or return false on failure?

I sometimes end up having to write a method or property for a class library for which it is not exceptional to have no real answer, but a failure. Something cannot be determined, is not available, not ...
3
votes
1answer
243 views

Is the structure used for these web pages a design pattern?

I want to know if the structure for an ASP.NET website I'm working on uses a design pattern for it's web pages. If it is a design pattern, what is it called? The web pages have the following ...
3
votes
2answers
604 views

Should this code/logic be included in Business Objects class or a separate class?

I have created a small application which has a three tier architecture and I have business object classes to represent entities such as User, Orders, UserType etc. In these classes I have methods that ...
-2
votes
1answer
305 views

Design Pattern for building a Budget

So I've looked at the Builder Pattern, Abstract Interfaces, other design patterns, etc. - and I think I'm over thinking the simplicity behind what I'm trying to do, so I'm asking you guys for some ...
3
votes
2answers
220 views

Design suggestions needed to create a MathBuilder framework

Let explain what I'm trying to create. I'm creating a framework, the idea is to provide base classes to generate a math problem. Why do I need this framework? Because at first time, I realized when I ...
8
votes
7answers
862 views

Difference between Pattern and Principle

What is the difference between Object Oriented Design Patterns and Principles? Are they different things? As far as I understood both of them try to achieve some common goal (e,g. flexibility). So can ...
2
votes
1answer
311 views

Making Modular, Reusable and Loosely Coupled MVC Components

I am building MVC3 application and need some general guidelines on how to manage complex client side interaction between my components. Here is my definition of one component in general way: ...
7
votes
1answer
606 views

Using visitor pattern with large object hierarchy

Context I've been using with a hierarchy of objects (an expression tree) a "pseudo" visitor pattern (pseudo, as in it does not use double dispatch) : public interface MyInterface { void ...
-2
votes
3answers
190 views

I have to run certain number of statements (which are executing .exe) in a loop

I have to run certain number of statements (which are executing .exe) in a loop. ForEach(object obj in ListOfVersions) { Step 1: call Exe1 Args=obj.somevalues Log Step 1 completed ...
3
votes
5answers
606 views

Pattern for select case on object type (of interface)

I have read that doing a select case is often a code smell. There are cases however where an interface cannot solve my problem. For instance, I have a set of date filter objects (last 7 days, last ...
4
votes
3answers
216 views

As a tooling/automation developer, can I be making better use of OOP?

My time as a developer (~8 yrs) has been spent creating tooling/automation of one sort or another. The tools I develop usually interface with one or more API's. These API's could be win32, WMI, ...
2
votes
3answers
491 views

Implementing Command Pattern in Web Application

I'm looking to implement the command pattern in a web application (asp.net c#)... Since the commands come in text format from the client, what is the best way to translate the string to a command ...
0
votes
1answer
968 views

Implementing a ILogger interface to log data

I have a need to write data to file in one of my classes. Obviously I will pass an interface into my class to decouple it. I was thinking this interface will be used for testing and also in other ...
10
votes
2answers
3k views

Separating data access in ASP.NET MVC

I want to make sure I'm following industry standards and best practices with my first real crack at MVC. In this case, it's ASP.NET MVC, using C#. I will be using Entity Framework 4.1 for my model, ...
4
votes
3answers
910 views

How to use a MessageBox using the MVVM pattern?

I am implementing a UI application using the MVVM design-pattern. The thing is, sometimes when you detect that something is wrong with data that was inputted by the user, you'd like to notify him ...
0
votes
1answer
246 views

What would you call this design pattern?

Design pattern, or maybe antipattern? The whole idea is to NOT runtime-cast the IDispatch object. I have a method which should handle different IDispatch, but they must be privilege to the concrete ...
3
votes
1answer
161 views

Exposing warnings\errors from data objects (that are also list returned)

I'm exposing Data objects via service oriented assembly (which on future usages might become a WCF service). The data object is tree designed, as well as formed from allot of properties.Moreover, ...
3
votes
1answer
204 views

What are the relative merits for implementing an Erlang-style “Continuation” pattern in C#

What are the relative merits (or demerits) for implementing an Erlang-style "Continuation" pattern in C#. I'm working on a project that has a large number of Lowest priority threads and I'm wondering ...
3
votes
2answers
488 views

“Worker object pool” pattern?

In my application requests are processed by objects of Processor-derived classes, something like CreateItemProcessor or MoveItemToGroupProcessor. Base Processor class implements most of common ...
4
votes
1answer
283 views

Architecture: for a Single website to be supported for different Clients

I have developed a system with one company profile. The system is built using WCF services, asp.net. Now another company wants to use our system as well. And they might need some customization and ...
5
votes
1answer
109 views

Checking members and instantiating in properties

Consider this: public MyClass { private Resource _myResource; public Resource MyResource { get { if(_myResource == null) { ...
5
votes
1answer
211 views

IClass, Class, ClassImpl pattern?

I've been seeing a lot of code recently that looks like this: public interface IFoo { int Bar(); } public static class Foo { public static IFoo Create() { return new FooImpl(); } private ...

1 2
15 30 50 per page