I'm not sure that the code you read was of high quality (in the past I looked at some bioinformatics code and, unfortunately, was often not written by professional developers). For example, this third constructor is not a copy constructor and, as a rule, there are problems in this code, so I won’t “read too much”.
The first constructor is the default constructor. It only initializes the minimum minimum and allows users to set the rest using getters and setters. Other constructors are often “convenience constructors” that help create objects with fewer calls. However, this often leads to inconsistency between the designers. In fact, there are recent studies that show that a default constructor followed by setter calls is preferred.
There are also certain cases where the default constructor is critical. For example, certain structures, such as digester (used to create objects directly from XML), use default constructors. JavaBeans usually use default constructors, etc.
In addition, some classes inherit from other classes. you can see the default constructor when the initialization of the parent object is "good enough".
In this particular case, if this constructor was not defined, it would be necessary to know all the details in advance. This is not always preferable.
And finally, some IDEs automatically generate a default constructor, it is possible that the person who wrote the class was afraid to eliminate it.
Uri
source share