By Topic

Why you should use routines...routinely

Sign In

Cookies must be enabled to login.After enabling cookies , please use refresh or reload or ctrl+f5 on the browser for the login options.

Formats Non-Member Member
$33 $13
Learn how you can qualify for the best price for this item!
Become an IEEE Member or Subscribe to
IEEE Xplore for exclusive pricing!
close button

puzzle piece

IEEE membership options for an individual and IEEE Xplore subscriptions for an organization offer the most affordable access to essential journal articles, conference papers, standards, eBooks, and eLearning courses.

Learn more about:

IEEE membership

IEEE Xplore subscriptions

1 Author(s)
S. McConnell ; Construx Software, USA

As an undergraduate computer science student, the author thought that the main reason to create new routines, instead of leaving all the code in one big routine, was to avoid duplicate code. This is undoubtedly the most popular reason for creating a routine, and it's a good one. Similar code in two routines is a warning sign. David Parnas says that if you use copy and paste while you're coding, you're probably committing a design error. Instead of copying code, move it into its own routine. Future modifications will be easier because you will need to modify the code in only one location. The code will be more reliable because you will have only one place in which to be sure that the code is correct. That is one good reason to create a routine, but it hardly makes a complete list. There are many additional reasons to create routines, and many of them are more important than avoiding duplicate code: reducing complexity; limiting effects of changes; hiding sequences; improving performance; hiding data structures; hiding global data; promoting code reuse; planning for a family of programs; improving readability; improving portability; isolating use of nonstandard language functions; and isolating complex operations

Published in:

IEEE Software  (Volume:15 ,  Issue: 4 )