Skip to main content

All Questions

3 votes
4 answers
5k views

Public static method calls private constructor

I'm working in a C# codebase that was largely written by a former developer and this pattern is used extensively... public class AuditInserter { public static void Insert( DataContext ...
amarsha4's user avatar
  • 176
4 votes
2 answers
1k views

When to use a static method instead of a constructor?

I have a short question for you: let's imagine that we have a class similar to this one. public class StreamTradeDataProvider : ITradeDataProvider { public StreamTradeDataProvider(Stream stream) ...
masm64's user avatar
  • 349
3 votes
1 answer
1k views

Handle Named constructors with factory pattern

In my current project I'm refactoring the code to get a DBAL. I have a class Entity that is the base class for all classes that model a database table. So there are several classes that inherit from ...
Tekay37's user avatar
  • 235
8 votes
1 answer
789 views

Is a large static initializer a code smell?

I am extending SimpleExpandableListAdapter in Android. I don't think Android's adapter is implemented very well, in that its constructors have a large number of rather complicated arguments and it has ...
TBridges42's user avatar
5 votes
5 answers
1k views

Requring static class setter to be called before constructor, bad design?

I have a class, say Foo, and every instance of Foo will need and contain the same List object, myList. Since every class instance will share the same List Object, I thought it would be good to make ...
roverred's user avatar
  • 397