Reputation
6,022
Top tag
Next privilege 10,000 Rep.
Access moderator tools
Badges
13 25
Newest
 Yearling
Impact
~389k people reached

Jun
26
awarded  Yearling
Jun
22
reviewed Approve Should the methods of a class call its own getters and setters?
Jun
21
awarded  Nice Answer
Nov
15
awarded  Pundit
Oct
5
comment Alternate string formatting options in C++?
The library looks comprehensive and robust. +1
Sep
30
awarded  Explainer
Sep
27
comment When should you create/destroy underlying object in a class that wraps it
Indeed - but in a language without destructors, that's part of the contract when handling unmanaged resources, such as files. Otherwise, you might never close them as long as your process is alive, and most likely never in the time you want to.
Sep
26
comment When should you create/destroy underlying object in a class that wraps it
And, as a general direction, that the constructor approach is only useful so long as you have access to the concrete class. As soon as you start getting into interfaces (or dependency injection), that sort of interface can pose some problems.
Sep
26
comment When should you create/destroy underlying object in a class that wraps it
I'd add gently, for the sake of completeness, that you still want a close() method even when you open it in the constructor.
Jun
26
awarded  Yearling
Apr
29
reviewed Approve gitlab tag wiki excerpt
Apr
29
reviewed Approve gitlab tag wiki
Mar
21
awarded  Guru
Mar
21
awarded  Custodian
Mar
21
reviewed Approve What is the difference between collation and character set?
Dec
10
answered Does Abstract Factory Pattern scale?
Nov
4
revised How you return to a code when you don't remember what you were doing?
deleted 2 characters in body
Oct
31
answered Should mock objects for tests be created at a high or low level
Oct
30
answered How you return to a code when you don't remember what you were doing?
Oct
30
comment Why is it not standard to implement abstraction layers for the file system?
+1 I believe what you were trying to say is "Presume the FS works and shouldn't be tested. Then, if you have a class that ReadsSomething(), implement it in terms of the interface GetSomething(), which this specific implementation of it just so happens to actually read from a file, which, as we said, is presumably working behavior."