Click here to Skip to main content
15,906,625 members
Home / Discussions / C#
   

C#

 
GeneralRe: msbuild success/failure condition c# Pin
PIEBALDconsult7-Mar-12 2:15
mvePIEBALDconsult7-Mar-12 2:15 
GeneralRe: msbuild success/failure condition c# Pin
canakcan7-Mar-12 3:07
canakcan7-Mar-12 3:07 
GeneralRe: msbuild success/failure condition c# Pin
PIEBALDconsult7-Mar-12 3:09
mvePIEBALDconsult7-Mar-12 3:09 
GeneralRe: msbuild success/failure condition c# Pin
Dave Kreskowiak7-Mar-12 3:52
mveDave Kreskowiak7-Mar-12 3:52 
GeneralRe: msbuild success/failure condition c# Pin
Dave Kreskowiak6-Mar-12 5:38
mveDave Kreskowiak6-Mar-12 5:38 
GeneralRe: msbuild success/failure condition c# Pin
PIEBALDconsult6-Mar-12 7:21
mvePIEBALDconsult6-Mar-12 7:21 
GeneralRe: msbuild success/failure condition c# Pin
Dave Kreskowiak6-Mar-12 9:09
mveDave Kreskowiak6-Mar-12 9:09 
GeneralRe: msbuild success/failure condition c# Pin
PIEBALDconsult6-Mar-12 9:17
mvePIEBALDconsult6-Mar-12 9:17 
GeneralRe: msbuild success/failure condition c# Pin
Dave Kreskowiak6-Mar-12 9:24
mveDave Kreskowiak6-Mar-12 9:24 
GeneralRe: msbuild success/failure condition c# Pin
PIEBALDconsult6-Mar-12 9:40
mvePIEBALDconsult6-Mar-12 9:40 
GeneralRe: msbuild success/failure condition c# Pin
jschell6-Mar-12 8:39
jschell6-Mar-12 8:39 
AnswerRe: msbuild success/failure condition c# Pin
PIEBALDconsult6-Mar-12 7:11
mvePIEBALDconsult6-Mar-12 7:11 
QuestionBinding combo-box to Entity Data Model Pin
pmcm6-Mar-12 4:44
pmcm6-Mar-12 4:44 
AnswerRe: Binding combo-box to Entity Data Model Pin
RobCroll6-Mar-12 10:48
RobCroll6-Mar-12 10:48 
GeneralRe: Binding combo-box to Entity Data Model Pin
pmcm6-Mar-12 22:37
pmcm6-Mar-12 22:37 
QuestionGetting information about a process's handles. Pin
Septimus Hedgehog6-Mar-12 2:09
Septimus Hedgehog6-Mar-12 2:09 
AnswerRe: Getting information about a process's handles. Pin
Eddy Vluggen6-Mar-12 5:20
professionalEddy Vluggen6-Mar-12 5:20 
AnswerRe: Getting information about a process's handles. Pin
Dave Kreskowiak6-Mar-12 5:35
mveDave Kreskowiak6-Mar-12 5:35 
GeneralRe: Getting information about a process's handles. Pin
Septimus Hedgehog6-Mar-12 6:50
Septimus Hedgehog6-Mar-12 6:50 
GeneralRe: Getting information about a process's handles. Pin
Septimus Hedgehog6-Mar-12 23:51
Septimus Hedgehog6-Mar-12 23:51 
QuestionHow do you enforce use of dedicated factories? Pin
GParkings6-Mar-12 0:07
GParkings6-Mar-12 0:07 
AnswerRe: How do you enforce use of dedicated factories? Pin
BobJanova6-Mar-12 0:40
BobJanova6-Mar-12 0:40 
Don't. You should use factories where they're appropriate, and allow people to instantiate objects directly where that's appropriate (i.e. when you don't need dynamic/runtime type switching on the instances that are created). Overuse of factories is a classic Java anti-pattern and quite an annoying habit to work with.

C# style is generally not factory heavy, unless you actually need to pass factory objects around for some reason (for example if you want to have a self-extending collection and pass a factory to it so it can create new elements). In the vast majority of cases you just want a normal set of classes with constructors.

If people are constructing objects without using a factory, ask yourself: what is wrong with that? If there is a good answer, you should be able to explain to the other devs how their life would be easier if they used a factory. If you can't do that, you're just being dogmatic and it's you that should adapt.

Your second approach doesn't work because anyone can inherit that class and provide a public constructor. Personally I'd say you should only use protected constructors in an abstract class, because otherwise you are either hiding something that works unnecessarily, or you have a constructor which does not leave the object in a valid state, and both of those things are generally bad.
GeneralRe: How do you enforce use of dedicated factories? Pin
GParkings6-Mar-12 1:01
GParkings6-Mar-12 1:01 
GeneralRe: How do you enforce use of dedicated factories? Pin
BobJanova6-Mar-12 1:58
BobJanova6-Mar-12 1:58 
GeneralRe: How do you enforce use of dedicated factories? Pin
GParkings6-Mar-12 2:30
GParkings6-Mar-12 2:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.