LB Booster
« Re: Help with Multi-user application »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 03:30am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1 2  Notify Send Topic Print
 hotthread  Author  Topic: Re: Help with Multi-user application  (Read 1398 times)
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Help with Multi-user application
« Reply #15 on: Sep 11th, 2016, 01:08am »

on Sep 8th, 2016, 09:01am, roxyryan wrote:
I cannot break the program with the code below, it really works.

I've only just noticed this:

Code:
      try
         file.mode$ = "OUT"
         gosub [openorders]  ' open in read/write mode
      catch
         call delaysub, 100         
         gosub [openorders]
         goto [set.orders.lock.repeat]
      end try 

I need hardly say that if the GOTO here is ever taken the program will almost certainly suffer a slow and painful death. It takes some bravado to jump out of a Structured Exception Handling clause with a GOTO - the antithesis of structured programming!!

Richard.
User IP Logged

roxyryan
New Member
Image


member is offline

Avatar




PM


Posts: 4
xx Re: Help with Multi-user application
« Reply #16 on: Sep 11th, 2016, 12:05pm »

Richard
Thank you for the kind words, but I think I told you previously that I had displays in my testing to prove which path the program followed. The program most certainly goes through this "goto" statement, and it works, every time. As I said previously, there are no doubt prettier statements to achieve the same, but this works.
Dermot
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Help with Multi-user application
« Reply #17 on: Sep 11th, 2016, 1:06pm »

on Sep 11th, 2016, 12:05pm, roxyryan wrote:
The program most certainly goes through this "goto" statement, and it works, every time.

Well, it rather depends on how you define "works". It is certainly the case that executing a TRY statement, but not executing the matching END TRY statement, will leave LBB in an unstable state. For example, if a subsequent error were to occur (for any reason) it would not be reported, and LBB would most probably crash. So at the very least debugging the program would be made much more difficult because even a trivial typo could result in an unexplained non-obvious failure.

It's a bit like jumping out of a loop (like a FOR loop or a WHILE loop) with a GOTO. That may appear to 'work', and indeed the program may keep running apparently correctly for hours or more, but eventually it will crash out for no obvious reason. In those cases there is an 'official' way to exit the loop prematurely, but there's no legitimate way of terminating a TRY clause other than executing the END TRY.

It's the very fact that the incautious use of GOTO is so prone to creating a 'fragile' program that many people (including me) will say it should ideally never be used at all. It's a subject that creates a lot of heated argument, and some people vociferously defend the use of GOTO, but even its most ardent supporters have to admit that it must be used with extreme care.

It's a basic tenet of Software Engineering that you cannot ascertain whether a program works or not by testing alone. Testing is valuable, but in most cases it cannot hope to exercise every possible path through a program, nor confirm that a program will remain stable even if left running for a very long time. 'Following the rules' is just as important as testing for ensuring that a program is reliable and resilient.

Richard.
« Last Edit: Sep 11th, 2016, 2:42pm by Richard Russell » User IP Logged

Pages: 1 2  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls