RE: [U2] : Cleaner Case Statement

2007-07-26 Thread Les Hewkin
Coming from somewhere with over 40 developers the first thing that comes
to mind is KISS. Why or why would you want to change a very simple easy
to read case statement for something more contrived? We train developers
to write clean easy to maintain code. When I say we what I mean is we
get Martin in for two weeks and then I introduce them to our standards.
Must nip upstairs and see how Martin is getting on..bye..


Les Sherlock Hewkin 
Project Manager - Financial Systems 
01604 592289 


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brutzman, Bill
Sent: 25 July 2007 18:55
To: 'u2-users@listserver.u2ug.org'
Subject: RE: [U2] : Cleaner Case Statement

Martin:

Thanks very much indeed.

--Bill


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Martin Phillips
Sent: Wednesday, July 25, 2007 12:38 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] [u2] : Cleaner Case Statement


Hi Bill,

Unlike languages such as C, Basic does not allow multiple conditions in
the way in which you are looking to do. In terms of run time performance
or program size, if it really is just a GOSUB, there whould be little
disadvantage in writing the more verbose form of your first example.


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

html
head
meta http-equiv=Content-type content=text/html; charset=UTF-8
/head
body
P style=MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0ptSPAN 
style=FONT-SIZE: 8.2pt; FONT-FAMILY: 'MS Sans Serif'This e-mail and any 
attachments are confidential and intended solely for the use of the addressee 
only. If you have received this message in error, you must not copy, distribute 
or disclose the contents; please notify the sender immediately and delete the 
message. /SPAN/P
P style=MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0ptSPAN 
style=FONT-SIZE: 8.2pt; FONT-FAMILY: 'MS Sans Serif'This message is 
attributed to the sender and may not necessarily reflect the view of Travis 
Perkins plc or its subsidiaries (Travis Perkins). Agreements binding Travis 
Perkins may not be concluded by means of e-mail communication. /SPAN/P
P style=MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0ptSPAN 
style=FONT-SIZE: 8.2pt; FONT-FAMILY: 'MS Sans Serif'E-mail transmissions are 
not secure and Travis Perkins accepts no responsibility for changes made to 
this 
message after it was sent. Whilst steps have been taken to ensure that this 
message is virus free, Travis Perkins accepts no liability for infection and 
recommends that you scan this e-mail and any attachments. /SPAN/P
P style=MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0ptSPAN 
style=FONT-SIZE: 8.2pt; FONT-FAMILY: 'MS Sans Serif'Part of Travis Perkins 
plc. Registered Office: Lodge Way House, Lodge Way, Harlestone Road, 
Northampton, NN5 7UG. /SPAN/P
/BODY
/HTML
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Cleaner Case Statement

2007-07-25 Thread Brutzman, Bill
ON is bad because it is in violation of the KISS principle. (Keep It So
Simple)

--Bill


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Perry Taylor
Sent: Wednesday, July 25, 2007 2:53 PM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] [u2] : Cleaner Case Statement


Someone want to explain to me why ON GOSUB is bdd ?
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Karen Bessel
Sent: Wednesday, July 25, 2007 1:06 PM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] [u2] : Cleaner Case Statement

ON GOSUB..Bad. Bill, that is a bad coding practice -
don't go there.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Manu Fernandes
Sent: Wednesday, July 25, 2007 12:44 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] [u2] : Cleaner Case Statement

Try this 

ON index('AB2',Ans,1) GOSUB Check.A, Check.B, Check.B

Manu 
- Original Message - 
From: Brutzman, Bill [EMAIL PROTECTED]
To: u2-users@listserver.u2ug.org
Sent: Wednesday, July 25, 2007 5:48 PM
Subject: [U2] [u2] : Cleaner Case Statement


 How can this structure be cleaned-up?
 
  begin case
case Ans = 'A'  ;  gosub Check.A
case Ans = 'B'  ;  gosub Check.B   
case Ans = '2'  ;  gosub Check.B  
  end   case
 
 The following is more difficult to read.
 
  begin case
case Ans = 'A'   ;  gosub Check.A
case Ans = 'B' or Ans = '2'  ;  gosub Check.B   
  end   case
 
 I would like something like...
 
  begin case
case Ans = 'A'  ;  gosub Check.A
case Ans = 'B'
case Ans = '2'  ;  gosub Check.B  
  end   case
 
 so that the gosub Check.B command is not repeated.  I have tried a
few
 alternatives without a victory.
 
 Suggestions would be appreciated.
 
 --Bill
 ---
 u2-users mailing list
 u2-users@listserver.u2ug.org
 To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is
for the sole use of the intended recipient(s) and may contain confidential
and privileged information.  Any unauthorized review, use, disclosure or
distribution is prohibited. ZirMed, Inc. has strict policies regarding the
content of e-mail communications, specifically Protected Health Information,
any communications containing such material will be returned to the
originating party with such advisement noted. If you are not the intended
recipient, please contact the sender by reply e-mail and destroy all copies
of the original message.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] Cleaner Case Statement

2007-07-25 Thread Kevin King
Hold the phone...  That's a valid syntax?  On what platform?

On 7/25/07, Martin Phillips [EMAIL PROTECTED] wrote:

  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
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Cleaner Case Statement

2007-07-25 Thread Karen Bessel
Readability = better maintainability

ON/GOSUB # Readability

ThereforeON/GOSUB # better maintainability.

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






-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Martin Phillips
Sent: Wednesday, July 25, 2007 4:28 PM
To: u2-users@listserver.u2ug.org
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
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] : Cleaner Case Statement

2007-07-25 Thread Brutzman, Bill
To answer the question... that was not the original question.

The original question is just under I would like something like...

Martin Philips indicated that what I want cannot be done right now with
UniBasic.

--Bill

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Rotella, Leon M.
Sent: Wednesday, July 25, 2007 2:54 PM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] [u2] : Cleaner Case Statement


Just to be different...

Why not add a new label called Check.2 put it right before the label
Check.B

Then the code would look like:

 
  begin case
case Ans = 'A'  ;  gosub Check.A
case Ans = 'B'  ;  gosub Check.B   
case Ans = '2'  ;  gosub Check.2
case 1  ;  gosub error.condition or null  
  end   case

This would help from a maintenance standpoint, if later on Check.2
needed it's own code differing than Check.B




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dave Davis
Sent: Wednesday, July 25, 2007 1:22 PM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] [u2] : Cleaner Case Statement

Not good if answer is not limited to one character wide.

Isn't ON  GOSUB out of style?

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Manu Fernandes
Sent: Wednesday, July 25, 2007 12:44 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] [u2] : Cleaner Case Statement

Try this 

ON index('AB2',Ans,1) GOSUB Check.A, Check.B, Check.B

Manu
- Original Message -
From: Brutzman, Bill [EMAIL PROTECTED]
To: u2-users@listserver.u2ug.org
Sent: Wednesday, July 25, 2007 5:48 PM
Subject: [U2] [u2] : Cleaner Case Statement


 How can this structure be cleaned-up?
 
  begin case
case Ans = 'A'  ;  gosub Check.A
case Ans = 'B'  ;  gosub Check.B   
case Ans = '2'  ;  gosub Check.B  
  end   case
 
 The following is more difficult to read.
 
  begin case
case Ans = 'A'   ;  gosub Check.A
case Ans = 'B' or Ans = '2'  ;  gosub Check.B   
  end   case
 
 I would like something like...
 
  begin case
case Ans = 'A'  ;  gosub Check.A
case Ans = 'B'
case Ans = '2'  ;  gosub Check.B  
  end   case
 
 so that the gosub Check.B command is not repeated.  I have tried a 
 few alternatives without a victory.
 
 Suggestions would be appreciated.
 
 --Bill
 ---
 u2-users mailing list
 u2-users@listserver.u2ug.org
 To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Cleaner Case Statement

2007-07-25 Thread Boydell, Stuart
Personally I like the match or index syntax.
   case ans match 'b':@vm:2 gosub checkb
   case index('b2',quote(ans),1) gosub checkb
I also continue to feel there is a very good case for subroutine indirection
which would give:
   sub = 'check':ans
   gosub @sub



Use Case Ans matches 2]B, using the MV separator between the 2 and the



**
This email message and any files transmitted with it are confidential and
intended solely for the use of addressed recipient(s). If you have received
this communication in error, please reply to this e-mail to notify the sender
of its incorrect delivery and then delete it and your reply.  It is your
responsibility to check this email and any attachments for viruses and defects
before opening or sending them on. Spotless collects information about you to
provide and market our services. For information about use, disclosure and
access, see our privacy policy at http://www.spotless.com.au
Please consider our environment before printing this email.
**
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] : Cleaner Case Statement

2007-07-25 Thread Brutzman, Bill
Martin:

Thanks very much indeed.

--Bill


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Martin Phillips
Sent: Wednesday, July 25, 2007 12:38 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] [u2] : Cleaner Case Statement


Hi Bill,

Unlike languages such as C, Basic does not allow multiple conditions in the 
way in which you are looking to do. In terms of run time performance or 
program size, if it really is just a GOSUB, there whould be little 
disadvantage in writing the more verbose form of your first example.


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