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

前端 未结 19 1910
悲&欢浪女
悲&欢浪女 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:48

    I'd probably just pass enough to initialize the object and then have a 'parse' method. The idea is that expensive operations should be as obvious as possible.

提交回复
热议问题