Scott Meyers wrote:
<snip>
So, library users, what do you prefer, and why?
I prefer complete construction 100% - if an object cannot operate it should throw from its constructor. I think the design of .NET libraries is influenced by the capabilities of all the languages it supports, and also because methods may be called _after_ an object is dispossed via a direct call to the Dispose method. In .NET it is pretty common to create an object, set a bunch of properties and then use it (UI widgets for example). However, even when some of the properties of an object may be set after construction, the object constructor should set default values for member variables so the object methods can be called safely. For example, if I create a button instance via a default constructor I should be able to ask the button to draw itself before I set X, Y, width, height and color (even if it draws a black 1x1 box). Those are my 2 cents, Thanks, -delfin