Re: Update script for 329841 finished. Comments?



On Mon, 2006-03-06 at 12:18 +0100, Thomas Van Machelen wrote:
> HI Bengt
> 
> 2006/3/6, Bengt Thuree <bengt thuree com>:

> It's not that the code isn't clear enough, it's just a matter of
> reducing code nesting and making code look easier on the eye.
> 

>         This take precious space, instead write it like this:
> 
>                 for (i = 0; i < 10; i++) {
>                         if (! Something (i))
>                                 continue;
>                         DoMore ();
>                 }

Thanks for more comments :) Much appreciated. Always rewarding when
someone else actually looks at the patches you know.

If you guys insist I will try to modify the code. Need to think of how
to do it though, since I have not used continue before, and the use of
it does not come natural for me.

Why I am not using continue? And have I read the hacking document?

Ok, I guess I will be crucified.... :)

But, in my days as a software engineer I have been taught that it is not
about writing the best software, but the one that is easiest to
maintain.

An IF statement that is negative is not really that easy to follow (it
is not natural after all). Then again, perhaps I am just from the old
school. 

If you ask me (which you are not :) ) space comes definitely second to
understandable code with comments. Space is easy. If anything if/then
should be replaced with smaller functions. This update routine I wrote
should preferably be broken down into 5-8 smaller routines if you ask
me.

>From the "O'Reilly's Programming C#, page 47 "Break and continue create
multiple exit points and make for hard-to-understand, and thus
hard-to-maintain, code. Use them with some care"

And yes, I read the paragraph about Linus tip, and I was a bit shocked
to be honest. (I have read the F-Spot hacking document a few times. Have
also waited for some feedback on some of my patches)

Personally, I have avoided continue (goto) statements ever after I
stopped using basic on a Vic64 a long time ago.

/Bengt




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]