How much work should the constructor for an HTML parsing class do?

前端 未结 19 1945
悲&欢浪女
悲&欢浪女 2020-12-23 09:55

How much work is it reasonable for an object constructor to do? Should it simply initialize fields and not actually perform any operations on data, or is it okay to have it

19条回答
  •  醉酒成梦
    2020-12-23 10:25

    Misko Hevery has a nice story on this subject, from a unit testing perspective, here.

提交回复
热议问题