Readability = better maintainability

ON/GOSUB # Readability

Therefore....ON/GOSUB # better maintainability.

As one of my teenaged daughters would say, ON/GOSUB is sooooooooooo
1980s. :)






-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Martin Phillips
Sent: Wednesday, July 25, 2007 4:28 PM
To: [email protected]
Subject: Re: [U2] Cleaner Case Statement

> "ON" is bad because it is in violation of the KISS principle. (Keep It
So
> Simple)

You have to be kidding!

Consider a simple menu option processor...

INPUT OPTION
IF OPTION MATCHES '1N' THEN
   ON OPTION GOSUB OPTION1,  ;* helpful comment
                                       OPTION2,  ;* blah bah
                                       OPTION3,  ;* blah blah
                                       ERROR
END

compared with

INPUT OPTION
BEGIN CASE
   CASE OPTION = 1
      GOSUB OPTION1  ;* helpful comment
   CASE OPTION = 2
      GOSUB OPTION2  ;* blah blah
   CASE OPTION = 3
      GOSUB OPTION3  ;* blah blah
   CASE 1
      GOSUB ERROR
END CASE

Personally, I find the first one much neater and simpler. It gets more
so as 
the list of options grows. It will also be faster to execute, not that
this 
is likely to be much of a problem.

Let's not turn this into yet another debate about coding style but just 
accept that we each have our own preferences.


Martin Phillips
Ladybridge Systems Ltd
17b Coldstream Lane, Hardingstone, Northampton, NN4 6DB
+44-(0)1604-709200 
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to