The initialization of an object with a constructor -- that is, single-stage construction in this context -- is a cornerstone of C++'s strict typing semantics. It means that if an object exists, then it will work fully and properly. It is an aspect of encapsulation, that conveys a guarantee to software built upon it.
Two-stage construction means it is possible to have objects that do not actually represent invariants. Code using such classes is not really getting a strictly enforced type at all, and has to be able to handle anomalous cases too. In a sense some of the responsibility and information has leaked out of the class. The notion of construction is vitiated.
To deliberately eschew proper construction goes very much against the grain. Your most prominent cause was to reduce the amount of code written, and this is nowhere near justification. You cannot compromise higher structural integrity for the sake of a bit of inconvenient work.
(The other reasons were incidental: you would be handling them elsewhere anyway. And Mr Wilson dealt with them earlier.)
Maybe this sounds too strict. But I think strictness is good. It is likely to benefit the product.
Flat View: This topic has 15 replies
on 2 pages
[
«
|
12
]