Relative Content

Tag Archive for initialization

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 […]

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.

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: