[haiku-commits] Re: haiku: hrev45422 - src/apps/deskbar

  • From: Siarzhuk Zharski <zharik@xxxxxx>
  • To: <haiku-commits@xxxxxxxxxxxxx>
  • Date: Fri, 29 Mar 2013 20:08:14 +0100

Dear John,

John Scipione писал 29.03.2013 18:45:
How about an _Init() method called by all constructors instead?

That would be overkill for just a for loop setting the pointers to
NULL.

Overkill how? Is duplicating the code somehow better/simpler?

IMHO readability would be worsened more by introduction an _Init()
function than you'd gain by avoiding duplicating the code snippet.

Using _Init call is our common practice and is more error-proof than multiple raw initializations. You must reduce any possibility of future errors. The code is usually refactored many times - and you have to think about those who will work on it after you. Just to not be blamed. And it is obvious, that some time this _Init routine will be extended by adding more initialization stuff into it some time in the future. So just simplify the task for your followers and think forward.

--
Kind Regards,
 S.Zharski

Other related posts: