Repepetition structures, or loops, are used when a
program needs to repeatedly process one or more instructions until
some condition is met, at which time the loop ends. Many
programming tasks are repetitive, having little variation from one
item to the next. The process of performing the same task over and
over again is called iteration.
Advantages
- Complexity can be reduced using the concepts of divide and
conquer.
- Logical structures ensure clear flow of control.
- Increase in productivity by allowing multiple programmers to
work on different parts of the project independently at the same
time.
- Modules can be re-used many times, thus it saves time, reduces
complexity and increase reliability.
- Easier to update/fix the program by replacing individual
modules rather than larger amount of code.
- Ability to either eliminate or at least reduce the necessity of
employing GOTO statement.
Disadvantages
- Since Goto statement is not used, the structure of the program
needs to be planned meticulously.
- Lack of Encapsulation.
- Same code repetition
- Lack of information hiding
- Change of even a single data structure in a program
necessitates changes at many places throughout it, and hence the
changes becomes very difficult to track even in a reasonable sized
program.
- Not much reusability of code.
- Can support the software development projects easily up to a
certain level of complexity. If complexity of the project goes
beyond a limit, it becomes difficult to manage.