All Questions
4 questions
-2
votes
1
answer
300
views
Why aren't constructors atomic? [closed]
If thrown exceptions in constructors can lead to memory leaks or partially-constructed objects, then why we don't make them atomic? so neither an object nor it's local variables will get created/...
2
votes
4
answers
872
views
What do OOP languages gain from having constructors that always return an object?
In what seems like a deliberate design decision, C++ does not have a null value for objects and references. This makes using objects and references very elegant since we don't have to perform null ...
1
vote
0
answers
514
views
Are constructors with complex initialization logic always bad? [duplicate]
I've recently read this blog post regarding what a constructor should do and I am also reading Eric Evans' book on Domain Driven Design.
Both the blog post and the book state that a constructor ...
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 ...