We had an argument about constructor overloading vs static functions that creates an instance with no args constructor and then sets the variables. It lasted too long so we decided agree to disagree.

  • 0
    So you did both?
  • 0
    @alexbrooklyn on the project he was the lead in we did his way, on mine my way.
  • 0
    What language is that? In C#, a static factory method wins over a constructor, especially when type arguments are needed, given that the static method's type arguments can (usually) be inferred, while the contructor's type arguments must be specified.

    And if you need to set variables on the class instance after creating it, I dare say you may be doing it wrong—it smells of procedural spaghetti code with a thin OOP layer.
Add Comment