Link Details

Link 280457 thumbnail
User 355617 avatar

By piccoloprincipe
via giorgiosironi.blogspot.com
Published: Nov 07 2009 / 00:15

One of the pillars of design for testability, which is listed also in the Google guide for code reviewers, is to have constructors that do not contain logic or method calls. I will explain the reasons behind this choice with an example, but let me say that to reduce dependencies it is natural for a class to avoid making assumptions on the external environment, performing things like creating new objects. Separating the business responsibility of a class from the one of wiring itself to other objects is necessary.
  • 12
  • 0
  • 1265
  • 342

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.