From: Willem on
Richard Heathfield wrote:
) Nick Keighley wrote:
)<snip>
)
)>
)> Your code compiles and runs and gives the same answers for both
)> functions.
)>
)> But it still says they both have a complexity of 5
)> Ah, but the graphs look much more similar. Near identical.
)> Pictures on their way
)
) And now they're on the Web. Please note that, as the URL suggests...
)
)<http://www.cpax.org.uk/scratch/seseseme.php>
)
) ...I'm liable to reclaim that scratch space at any time. (In practice,
) I'll probably be too lazy, though, so the link should be good for a
) little while yet.)
)
) Personally, I find the SESE (right-hand) version to be visually simpler.

In the SESE version, it is not obvious that the function ends
immediately when a point has been found. A graph of a function
that would always loop through all items would be identical,
except for the text inside the graphics.

In the SEME graph, it *is* immediately obvious that the function
ends as soon as a match is found.

So, yes, the SEME graph is slightly more complex, and that is
because the graph itself shows the early exit.


SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
From: Richard Heathfield on
In <slrnhuo3ke.18o2.willem(a)turtle.stack.nl>, Willem wrote:

> Richard Heathfield wrote:

<snip>
> )
> ) Personally, I find the SESE (right-hand) version to be visually
> simpler.
>
> In the SESE version, it is not obvious that the function ends
> immediately when a point has been found.

To me, though, it /is/ obvious. Funny how different people see things
in different ways.

<snip>

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
"Usenet is a strange place" - dmr 29 July 1999
Sig line vacant - apply within
From: Lie Ryan on
On 05/14/10 01:34, Richard Heathfield wrote:
> In <slrnhuo3ke.18o2.willem(a)turtle.stack.nl>, Willem wrote:
>
>> Richard Heathfield wrote:
>
> <snip>
>> )
>> ) Personally, I find the SESE (right-hand) version to be visually
>> simpler.
>>
>> In the SESE version, it is not obvious that the function ends
>> immediately when a point has been found.
>
> To me, though, it /is/ obvious. Funny how different people see things
> in different ways.

To me, it is not obvious because the function ends when the exit flag is
set not when the point is found.
From: Daniel T. on
Richard Heathfield <rjh(a)see.sig.invalid> wrote:
> Nick Keighley wrote:

> > Your code compiles and runs and gives the same answers for both
> > functions.
> >
> > But it still says they both have a complexity of 5
> > Ah, but the graphs look much more similar. Near identical.
> > Pictures on their way
>
> And now they're on the Web. Please note that, as the URL suggests...
>
> <http://www.cpax.org.uk/scratch/seseseme.php>
>
> ...I'm liable to reclaim that scratch space at any time. (In practice,
> I'll probably be too lazy, though, so the link should be good for a
> little while yet.)
>
> Personally, I find the SESE (right-hand) version to be visually simpler.

Something interesting that I've noticed over the years. In every
debugger I've used (maybe 5 in all,) when I'm stepping through the code
and the code point hits a return statement, the next step doesn't exit
the function, instead it jumps to the close brace that ends the
function. By that light, all functions are SESE even if you put multiple
returns in them.
From: Richard Heathfield on
In <daniel_t-70D133.20404613052010(a)70-3-168-216.pools.spcsdns.net>,
Daniel T. wrote:

> Richard Heathfield <rjh(a)see.sig.invalid> wrote:
<snip>
>>
>> Personally, I find the SESE (right-hand) version to be visually
>> simpler.
>
> Something interesting that I've noticed over the years. In every
> debugger I've used (maybe 5 in all,) when I'm stepping through the
> code and the code point hits a return statement, the next step
> doesn't exit the function, instead it jumps to the close brace that
> ends the function. By that light, all functions are SESE even if you
> put multiple returns in them.

Your observation squares with mine wrt closing braces, but I don't
draw the same conclusion that you do. There is a tendency (which, I
hasten to add, is by no means 100%) for multiple exits to lead to
spaghetti flow, and the fact that a debugger jumps to the closing }
(be it in a function or in a loop within a function) while tying the
next knot is neither here nor there.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
"Usenet is a strange place" - dmr 29 July 1999
Sig line vacant - apply within
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4
Prev: on complexity [Was: on goto]
Next: on complexity