Tagged Questions
30
votes
7answers
15k views
When to use abstract classes instead of interfaces with extension methods in C#?
"Abstract class" and "interface" are similar concepts, with interface being the more abstract of the two. One differentiating factor is that abstract classes provide method implementations for derived ...
29
votes
5answers
8k views
When do you use a struct instead of a class?
What are your rules of thumb for when to use structs vs. classes? I'm thinking of the C# definition of those terms but if your language has similar concepts I'd like to hear your opinion as well.
I ...
7
votes
5answers
692 views
Abstract DAL - Use Interface with Internal Class?
We have a business logic layer (BLL) that is tightly coupled to our data access layer (DAL). We make calls like this:
using (FooData data = new FooData())
{
data.DoSomething();
}
It's important ...
4
votes
3answers
469 views
What should I name these methods?
I have two interfaces, one with and one without generic type parameters. The non-generic interface is used internally so that I can store instances of the generic interface in a collection. All would ...
11
votes
3answers
3k views
How do I set up MVP for a Winforms solution?
Question moved from Stackoverflow - http://stackoverflow.com/questions/4971048/how-do-i-set-up-mvp-for-a-winforms-solution
I have used MVP and MVC in the past, and I prefer MVP as it controls the ...
16
votes
7answers
835 views
S.O.L.I.D., avoiding anemic domains, dependency injection?
Although this could be a programming language agnostic question, I'm interested in answers targeting the .NET ecosystem.
This is the scenario: suppose we need to develop a simple console application ...
3
votes
2answers
5k views
ASP.NET MVC 3 (C#) Software Architecture
I am starting on a relatively large and ambitious ASP.NET MVC 3 project and just thinking about the best way to organize my code. The project is basically going to be a general management system that ...
12
votes
4answers
1k views
Is It “Wrong”/Bad Design To Put A Thread/Background Worker In A Class?
I have a class that will read from Excel (C# and .Net 4) and in that class I have a background worker that will load the data from Excel while the UI can remain responsive. My question is as follows: ...
1
vote
3answers
474 views
Coding to interfaces
I understand why it is a good idea to code to an interface rather than to a concrete class. I find it hard to implement though as other methods generally need to use properties of the given object. ...