[sclug] Code

Neil Haughton haughtonomous at googlemail.com
Fri Sep 25 13:59:38 UTC 2009


---------- Forwarded message ----------
From: Neil Haughton <haughtonomous at googlemail.com>
Date: 2009/9/25
Subject: Re: sclug Digest, Vol 72, Issue 14
To: sclug at sclug.org.uk



>
> >                         if (TemporaryDataStore.MoveToMemory(dataRows) ==
> > false)
> >                         {
> >                             //do nothing
> >                         }
> >                         else
> >                         {
> >                             ProcessData(dataRows);
> >                         }
> >
> >
>
> I'm going to stick my head above the parapet again for a few minutes
> because I'm interested in this.
>
> Having had no formal training in coding (largley taught myself), my code
> tends to look a bit like that, maybe with a comment above it reminding
> me of my intention. I'd be interested to know why it's not acceptable,
> largley in the interest of improving myself!
>
>
It boils down to


if (TemporaryDataStore.MoveToMemory(dataRows))
{

>             ProcessData(dataRows);
>


or, if you must:

if (TemporaryDataStore.MoveToMemory(dataRows)==true)

>             ProcessData(dataRows);
>


which, (either of these) being the simpler form, is the one to use. It is
more intuitive to read, it is (IMHO) clearer. The original is counter
intuitive (to me, at least).Code should express the solution in the most
concise yet still understandable form.

Neil.



More information about the Sclug mailing list