I realise that I've largely been a lurker of late - making a living working
with jBASE pretty much full time now - but I'm afraid I can't let all these
apologists for our spaghetti inheritance slide by unchallenged.

 

My view on code structure is very simple:

 

One way in, one way out.  Any block of code, no exceptions.  Deal with it.  

 

I understand the point about deep indentations making code unreadable -
especially in the ubiquitous line editors that some people still insist on
using - but you can still code single entry/single exit point without
nesting anything especially deeply.  That's what GOSUB and CALL are for.

 

The poster who talked here about modern languages encouraging the throwing
of exceptions, and suggested that multiple exit point code in BASIC emulated
this missed the point that those languages provide exception handling
mechanisms such that you can always engineer a single exit point for each
block, and if you don't, then the language effectively creates one - perhaps
slightly further away - for you.  MV BASIC on the other hand provides
absolutely no exception handling other than what is explicitly coded.
Indeed, if you want single exit point code in BASIC you have to work hard
for it, and many of the posters here clearly can't be bothered to.  Not that
they're alone - pretty much every poxy 'C' example code segment you read in
an article or text book leaks like a sieve, carrying a weak disclaimer about
error handling code being omitted for the sake of simplicity or clarity -
and I've seen plenty of that sort of 'C' code distributed into production.
Don't worry, I'd have them up against the wall too, come the revolution.  It
wouldn't just be the spaghetti BASIC merchants facing the wrong end of a
firing squad when I took over the world!

 

Meanwhile, Mark, whose posts are almost guaranteed to stir me up, but who I
almost always manage to calm down and ignore, actually brushed up against an
important point during this thread - that the implicit top down evaluation
of CASE statements can sometimes hide the logic that is being coded and
cause grief to future programmers.  Don't get me wrong - I'm a firm believer
in CASE statements, but I do think that coders sometimes actively use the
top down evaluation within them to achieve a purpose they don't document,
and that sometimes they just get lucky.  In either of these situations, the
maintenance programmer who follows behind can make a simple alteration and
spend days working out what they've broken.

 

That's my 2 cents worth, and I've got my flame suit buttoned up tight ;^)

 

Cheers,

 

Ken 

 

-----Original Message-----
From: Marco Manyevere
Sent: Thursday, 29 November 2007 3:18 AM
To: u2-users@listserver.u2ug.org
Subject: [U2] Deep and long indentations vs multiple exit points

 

There has been a lot said recently about styles, standards and good practice

and I wonder what your take is on deeply indented routines with a common
exit

point versus unindented routines but with multiple exit points
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to