StudentShare
Contact Us
Sign In / Sign Up for FREE
Search
Go to advanced search...
Free

GoTo Statement and GoTo-Less Programming - Essay Example

Cite this document
Summary
From the paper "GoTo Statement and GoTo-Less Programming" it is clear that it is necessary to revoke the unlimited use of the goto statement from high-level languages as it results in problems while understanding and proving programs as well as in the process of debugging or modifying. …
Download full paper File format: .doc, available for editing
GRAB THE BEST PAPER92.2% of users find it useful
GoTo Statement and GoTo-Less Programming
Read Text Preview

Extract of sample "GoTo Statement and GoTo-Less Programming"

Although a goto statement represents a simple way of traveling around a program, it is generally regarded that excessive using goto statements may be fraught with serious consequences in a program as it usually results in problems while reading code, generally known as a spaghetti code, making it not only unreadable but also unmaintainable (Tribble1).

A goto statement is a constituent of many languages like C, C++, COBOL, Pascal, Algol, and others, especially assembly languages. Nevertheless, a goto statement is not popular in all higher-level languages of programming. Thus in Java goto statement is a reserved statement at present (Tribble 3).

During the period of the early stage of structured programming development, many experts in computer science concluded that in programs it is better to use "structured flow-control commands", for example, loops and "if-then-else statements" rather than a goto statement (Tribble 5). Though there are experts who consider that even though "goto statement is considered harmful", there exist some problems in a great number of programming languages that can't be directly decided without a goto statement, like, for instance, exception handling or breaking out of nested loops (Knuth 268).

"There are few good uses for a goto statement. It is not uncommon for the class instructor to ban goto statements altogether. But the traditional legitimate use for a goto is to allow the programmer to escape from deep nesting when a special case (usually an error) has been encountered. For Pascal programmers, this means that, on rare occasions, you may want to ``go to'' the end of a subroutine to exit. For C programmers, such a goto is never justified since you can return from any point in a subroutine, and the keywords break and continue to allow you to break out of a loop.

FORTRAN programs may use goto's to simulate while statements or C-style break and continue statements" (Tribble 4).
The question of goto-less programming became of great concern in 1968 when a letter by Edsger Dijkstra appeared. "For several years I have been familiar with the observation that the quality of programmers is a decreasing function of the density of go-to statements in the programs they produce. More recently I discovered why the use of the go-to statement has such disastrous effects, and I became convinced that the go-to statement should be abolished from all "higher level" programming languages (i.e. everything except, perhaps, plain machine code)" (Dijkstra 147).

Among the disadvantages of using a goto statement in your program is also the high possibility of creating an infinite loop. Dijkstra also maintains that goto statements may only be reasonable for "alarm exits", which now we name "fatal exceptions" (Tribble 7). Thus he agrees that in those languages which doesn't have a strong mechanism of exception handling, goto statements may become the only reasonable practical substitute. Besides Dijkstra refers to the proposition made by Hoare and Wirth about the "construction of the case/select control flow structure" (417). Nowadays its usefulness is proven, but at that time it was a question of great concern. Dijkstra emphasizes its possibility be used as the best alternative to a great number of goto statements (Tribble 5). "He is arguing that some gotos in a program may be useful and may make the program easier to understand. So it is safe to say that Dijkstra considered goto statements to be harmful, but not lethal, and certainly not useless" (Tribble 6). Thus the best decision of the controversy would be to know "when to use goto statement for good and when not to use it for evil"  Read More
Cite this document
  • APA
  • MLA
  • CHICAGO
(“GoTo Statement Essay Example | Topics and Well Written Essays - 500 words”, n.d.)
Retrieved from https://studentshare.org/miscellaneous/1503851-goto-statement
(GoTo Statement Essay Example | Topics and Well Written Essays - 500 Words)
https://studentshare.org/miscellaneous/1503851-goto-statement.
“GoTo Statement Essay Example | Topics and Well Written Essays - 500 Words”, n.d. https://studentshare.org/miscellaneous/1503851-goto-statement.
  • Cited: 0 times

CHECK THESE SAMPLES OF GoTo Statement and GoTo-Less Programming

Differences and connections between groupware and ordinary databases, and why they matter

Groupware is a software application which is used to facilitate a group of people in their personal or business working inside the similar application or system, regardless of where they occur to be.... In this scenario, some of the well-known examples of groupware systems include newsgroups, email and chat....
19 Pages (4750 words) Essay

Programming with Objects

Answer In all programming languages, it is a practice to declare variables along with their types.... nswer An operator is simply a method implemented in a programming language to modify, replace, or combine values represented by variables.... Without operators, a programming language would not be very useful because the programmer would not be able to store or manipulate the data.... nswer It is often a requirement of a program to group items of same type say sales of an item X in Northern Region in one element to achieve preciseness and to make programming clearer, therefore sometimes repetitive data structures like array are used to group items of same type....
4 Pages (1000 words) Essay

Programming Paradigms Comparison

The essay "programming Paradigms Comparison" focuses on the critical analysis of the major issues in the comparison between programming paradigms.... C++ objects are members of its classes.... OOP possesses the feature of 'Inheritance', which enables it to import classes or subclasses....
9 Pages (2250 words) Essay

ARU's Bookstore Black Box Test Plan

If the cost based changes are concerned, the company has to pay for the programming and development costs for a period of 2 weeks more.... The assignment 'ARU's Bookstore Black Box Test Plan' presents tests of ARU's bookstore's HTML file and XML data file, discusses the main problems in ARU study - the products haven't got enough specification, the products have a bug on them and it's difficult to make a bug free product, etc....
14 Pages (3500 words) Assignment

Critical Difference Between Java and C#

Microsoft has certainly elevated the interest in programming languages with C#, however, this development is built exactly on the shoulders of the industry's four years of experience with Java.... The development of the C# language was led by Anders Hejlsberg and has a procedural, object-oriented syntax based on C++ and comprises features of several other programming languages with special attention to simplification.... # is supposed to be a simple, modern, general-purpose, object-oriented programming language (Wikipedia, 2008)....
12 Pages (3000 words) Essay

The Future of Advanced Business Application Programming

This paper 'The Future of Advanced Business Application programming' discusses the future of Advanced Business Application programming (ABAP) which is a fourth generation programming language was created by SAP.... ABAP stands in Advanced Business Application programming....
11 Pages (2750 words) Assignment

Pseudocode Standards

The following essay entitled "Pseudocode Standards" deals with the item look-up station implementation.... According to the text, in order to implement the item look-up station at every networked Wal-Mart outlet, information related to the items will have to be saved in the local database.... ... ...
2 Pages (500 words) Essay

Portfolio Php and Html Codes for 6 EX

In our case, this statement tells the compiler to loop through a block of code until the value in a variable day is not greater than 29.... Please note that in PHP:This statement calls a function money_format that returns a string formatted as a currency string, following by a call to another function echo to simply display the result (return value from money_format)....
30 Pages (7500 words) Case Study
sponsored ads
We use cookies to create the best experience for you. Keep on browsing if you are OK with that, or find out how to manage cookies.
Contact Us