Why the Go to Statement is Considered Harmful?
After placing structured programming in its historical perspective the question still remains; why is the go to considered harmful? There are many reasons and arguments against go to and are discussed next.
1. Go to are unnecessary
2. Clarity and Expressive Power
3. Readability ( static and Dynamic Structures )
4. Proving Program correct
1. Go to are Unnecessary : There is a mathematical theorem which guarantees that may program written using go to statement can be transformed into an equivalent program that uses only the structured constructs. This converted program will need some more data items that are used as flag s to control the actions of the program. Therefore, data items that are used programs with go to in them.
(a) Clarity and Expressive power : Use of go to statement reduces the clarity and expressive power of a program. It can be better understood with the help of an example. Consider and compare the following two equivalent program fragments as shown in fig 6.22.
In the program fragment . i we are not immediately sure about the roles of label and go to until we take some time to read and study the program in order to discover that they are being used to create the repetition of a piece of code. Whereas in the case of program fragment II it is immediately seen that while statement is used here for the repetition purpose.
There is a remaining doubt in the program fragment I that there may be another go to aimed at this same label form other point in the program. Even more a backward go to is like a loop statement and readability is considerably enhanced by coding a loop using the appropriate languages construct, rather than using a go to statement.
The facilities of a programming languages should allow people to describe what they want to do in a meaningful way. If we typical program written suing go to we see that the go to are used for a variety of purpose for example:
As the go to has a variety of purposes, it is not clear immediately that which purpose is used for go to in the program.
In summary the go to lacks expressive power and it is therefore difficult to understand the logic of a program that is written using a lot of go to when we look at a piece of coding words like while and if give us a strong clue as to what is intended go to do not.
(c) Readability ( Static and Dynamic Structures ) :A go to can decrease readability and hence, maintainability. Even worse is a conditional go to ( if -go to ) , because the flow of control depends on the values of the variables at execution time.
But the use of structured programming shows that it always increases readability. A structured program is said static as it can always be read from top to bottom, if it has no procedures. The exception to this rule arises in comprehending a while loop, during which repeated references back to the terminating condition at the start of the loop are necessary.
Program are essentially dynamic beings that exhibit a flow of control while program listing is a static piece of text. In a structured program, the flow of control is always down the page which exactly corresponds to the way that text is normally read.
(d) Proving Program Correct: To formally prove, all programs correct is not a practical proposition with present day techniques so there are some lessons that can be learned from proving.
In one technique of program proving, assertions are made at strategic point in the program. An assertion is a statement of what things are true at that point in the program. More exactly as assertion describes the relationships that hold between data items that the program acts upon. An assertion at the start and end of a piece of program code are called the input and output assertions respectively. Proving demonstrates that if the input assertion is true the action of the program will lead to the output assertion being true.
A structured program consists solely of components that have a single entry and a single exit point. This considerably aids the process of reasoning about the effect of the program. In contrast it is usually impossible to isolate single entry single exit structures within a program with go to init and reduces checking and understand ability.
These were some reasons why go to statements should be avoided and should not be used.
Latest technology based Software Engineering Online Tutoring Assistance
Tutors, at the www.tutorsglobe.com, take pledge to provide full satisfaction and assurance in Go to Statement homework help via online tutoring. Students are getting 100% satisfaction by online tutors across the globe. Here you can get homework help for Go to Statement, project ideas and tutorials. We provide email based Go to Statement homework help. You can join us to ask queries 24x7 with live, experienced and qualified online tutors specialized in Go to Statement. Through Online Tutoring, you would be able to complete your homework or assignments at your home. Tutors at the TutorsGlobe are committed to provide the best quality online tutoring assistance for Software Engineering homework help and assignment help services. They use their experience, as they have solved thousands of the software engineering assignments, which may help you to solve your complex issues of Go to Statement. TutorsGlobe assure for the best quality compliance to your homework. Compromise with quality is not in our dictionary. If we feel that we are not able to provide the homework help as per the deadline or given instruction by the student, we refund the money of the student without any delay.
Plant Hormones tutorial all along with the key concepts of Introduction to Cytokinins, Effects of Cytokinins, Cytokinins and Calcium, Ethylene, Effects of Ethylene, Ethylene and Auxin, Abscisic Acid, Effects of Abscisic Acid, Hormonal Interactions
Fm detector is termed as discriminator. Fm detector is a balanced double diode demodulator. Fm detector splits audio signal from frequency modulated IF signal.
www.tutorsglobe.com offers available operations homework help, assignment help, case study, writing homework help, online tutoring assistance by computer science tutors.
www.tutorsglobe.com offers Overhead Variances homework help, assignment help, case study, writing homework help, online tutoring assistance by accounting tutors.
the quality of the service that is provided is determined through the extent to which the requirements of the several user groups have been met.
tutorsglobe.com dentrification assignment help-homework help by online nitrogen cycle tutors
www.tutorsglobe.com offers biophysical chemistry homework help, biophysical chemistry assignment help, online tutoring assistance, physical chemistry solutions by online qualified tutor's help.
Avail 24x7 support of apt Trigonometry Assignment Help tutors to obtain plagiarism free papers and A++ grades at affordable prices.
weighing in the laboratory tutorial all along with the key concepts of weighing, weighing on an analytical balance, sample weighing experiment
theory and lecture notes of construction and mechanism of operation all along with the key concepts of construction of bjt, operation of n-p-n bjt, current components, minority carrier profile and notation to an n-p-n bjt. tutorsglobe offers homework help, assignment help and tutor’s assistance on construction and mechanism of operation.
tutorsglobe.com control of microorganisms assignment help-homework help by online general microbiology tutors
Theory and lecture notes of Imperfect Labour Markets all along with the key concepts of Monophony, Profit Maximization by a Monopolist, Prevalence of Monophony, Labour Mobility, Return and Repeat Migration. Tutorsglobe offers homework help, assignment help and tutor’s assistance on Imperfect Labour Markets.
Body organization of Astacus tutorial all along with the key concepts of Locomotion in astacus, digestive system and nutrition in astacus, Gaseous exchange in astacus, Excretory system in astacus
Theory and lecture notes of Construction and Mechanism of Operation all along with the key concepts of Physical Structure, Device Operation, Threshold Voltage and CMOS Structures. Tutorsglobe offers homework help, assignment help and tutor’s assistance on Construction and Mechanism of Operation.
Stability of Proteins tutorial all along with the key concepts of Protein Folding, Forces which Stabilize Protein, Hydrophobic Interaction, Hydrogen Bonding, Electrostatic Interaction, Protein Denaturation and Denaturating Agents
1963004
Questions Asked
3689
Tutors
1457994
Questions Answered
Start Excelling in your courses, Ask an Expert and get answers for your homework and assignments!!