What is the opposite of initialize (or init)? [closed]
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for […]
C++ – Constructor or Initialize Method to Startup [duplicate]
Possible Duplicate:
Avoid having an initialization method
Why does this static field always get initialized over-eagerly?
I am looking at this excellent article from Jon Skeet.
Data decoding initialization/Constructor error handling
I have a set of loadable data decoders for a specific type of data and a stream to read containing data. Now I want the program to select the correct decoder in a reliable way so I want to use a trial-and-error algorithm. It seems resonable to create a decoder and connect it to the stream using a constructor:
Initializing derived classes in the same way
I have a class Base that has several children, say A, B, C. For testing purposes I’d like to mock those derived classes by deriving from them. So MockA derives from A, MockB derives from B and so on.
What options are there to handle dependencies that may error?
I have an application, which contains a logger. The logger already exists and is ready to be used, so it can be passed directly to the constructor.
How to avoid init methods when 2 objects need the reference of each other?
According to https://softwareengineering.stackexchange.com/a/334972/432039, I know init is a code smell and should be avoided, and one of the solutions is to use a builder to hold the state first instead of create the object first and then set the state, like https://softwareengineering.stackexchange.com/a/452495/432039 mentions, eg:
Where should an object in CQRS+ES be fully initialized: in the constructor, or when applying the first event?
There appears to be widespread agreement in the OOP community that the class constructor should not leave an object partly or even fully uninitialized.
Where should an object in CQRS+ES be fully initialized: in the constructor, or when applying the first event?
There appears to be widespread agreement in the OOP community that the class constructor should not leave an object partly or even fully uninitialized.
Where should an object in CQRS+ES be fully initialized: in the constructor, or when applying the first event?
There appears to be widespread agreement in the OOP community that the class constructor should not leave an object partly or even fully uninitialized.