Tagged Questions
0
votes
1answer
216 views
Best place to write SQL queries
I've been working on this project for my company. Currently I am embedding my SQL statements inside the program itself as and when they are needed. I do have two seperate classes -
QueryBuilder ...
1
vote
1answer
156 views
What principle of OOAD is this pattern breaking?
I'm trying to make a case for not putting the structure in the parent BaseModule class I've shown below. I'm more for a Strategy Pattern, and minimizing inheritance in favor of has-a relationships, ...
0
votes
0answers
33 views
How to perform method [migrated]
I have class Person, two child classes Staff and Student, interface IPerson. Also I have a class Database and class Gateway. Class Database has
private string name = "username";
and method
...
1
vote
0answers
48 views
If SqlDataReader is going to be disposed, do I need to call close()? [migrated]
If I instantiate a SqlDataReader inside a using block, do I need to call close() on the reader?
Simple example of looking up a user shown below.
using (var connection = new ...
10
votes
2answers
376 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
59 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
122 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
76 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
136 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
251 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
126 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
225 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
186 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" ...
5
votes
4answers
362 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
149 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 ...