Showing posts with label constructor. Show all posts
Showing posts with label constructor. Show all posts

Friday, May 18, 2012

Virtual member call in a constructor


I'm getting a warning from ReSharper about a call to a virtual member from my objects constructor. Why would this be something not to do?

Wednesday, May 9, 2012

Java constructor with large arguments or Java bean getter/setter approach


I can't decide which approach is better for creating objects with a large number of fields (10+) (all mandatory) the constructor approach of the getter/setter. Constructor at least you enforce that all the fields are set. Java Beans easier to see which variables are being set instead of a huge list. The builder pattern DOES NOT seem suitable here as all the fields are mandatory and the builder requires you put all mandatory parameters in the builder constructor.

Java Constructor Inheritance


I was wondering why in java constructors are not inherited? You know when you have a class like this:

Friday, May 4, 2012