IfSQ logo


Papers, Presentations and Books

Journal Paper: Cover of IEEE Software

Why You Should Use Routines, Routinely

  • Steve McConnell
  • Recorded 1998 in IEEE Software Link to IEEE Software at www.computer.org/software, 15, no. 4, July/August
  • Pages 94-95
  • Abstract:
    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.
  • Link:
    Why You Should Use Routines, Routinely Link to Why You Should Use Routines, Routinely at ieeexplore.ieee.org/xpl/freeabs_all.jsp?isnumber=15098&arnumber=687957&count=22&index=21

Finding relevant to IfSQ Standards:

IfSQ Defect Indicators: