Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Original thread:
Post 7 made on Sunday March 22, 2009 at 20:02
Rusty Fobe
Long Time Member
Joined:
Posts:
December 2008
47
You're right about the mess simple goto's caused. Computed goto's and APL have been my favorites too, but that is a long time ago. Computed goto's because there were little alternatives. APL because you could program nice functional blocks, small entities of instructions dealing with one functional purpose, and a huge collection of statements. Even inner and outer join. A glimpse of future languages. Still in many things a language superior to many other, like dealing with matrices.

The switch statement looks like a computed goto, from which it was probably derived. Unfortunately it allows fall through, unless you break the flow in each case, which is the only right way to deal with switch. Errors in fall through are very difficult to detect. Likewise simple goto's look attractive, but can cause errors that are also very difficult to detect if one doesn't use them properly.

To my surprise, I learned that it was much easier to learn people how to deal properly with functions than how to deal properly with those simple looking goto's. A nice side effect was that my maintenance budget dropped drastically: programs became easier to understand by those that did not write them. Although indeed in a few cases goto's were a good solution, mostly written by or under supervision of (method)knowledgeable programmers. We did not go completely gotoless. It is from that experience that I write "avoid goto"s.

Having said that, I do think in Javascript you don't need them anymore (IMHO), with the advantage that you don't fall into the goto trap: becoming blind for better solutions.

Quoting Crockford: the worst features of a language aren't the features that are obviously dangerous or useless. Those are easily avoided. The worst features are the attractive nuisances, the features that are both useful and dangerous.


Hosting Services by ipHouse